Re: SCSI RAM driver ported to 3.3 kernel for file system and I/O testing

From: chetan loke
Date: Wed May 16 2012 - 15:31:55 EST


On Wed, May 16, 2012 at 1:07 PM, Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx> wrote:

> + Â Â Â while (!kthread_should_stop()) {
> + Â Â Â Â Â Â Â struct scsi_cmnd *cmnd;
> + Â Â Â Â Â Â Â struct scsi_ram_cmnd *ram_cmnd;
> +
> + Â Â Â Â Â Â Â spin_lock_irqsave(host->host_lock, flags);
> + Â Â Â Â Â Â Â if (list_empty(&ram_device->commands)) {
> + Â Â Â Â Â Â Â Â Â Â Â set_current_state(TASK_INTERRUPTIBLE);

> + Â Â Â Â Â Â Â Â Â Â Â spin_unlock_irq(host->host_lock);

The spin_[un]lock/ variants don't match.


> +static int scsi_ram_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)
....

> + Â Â Â if (use_thread) {
> + Â Â Â Â Â Â Â spin_lock_irqsave(shost->host_lock, flags);

> + Â Â Â Â Â Â Â if (list_empty(&ram_device->commands))
> + Â Â Â Â Â Â Â Â Â Â Â wake_up_process(ram_device->thread);

Didn't look in detail but if the queue is empty then why would you
want to wake up the kthread? What if you just wake_up after
list_add_tail below?


> + Â Â Â Â Â Â Â list_add_tail(&ram_cmnd->queue, &ram_device->commands);
> + Â Â Â Â Â Â Â spin_unlock_irqrestore(shost->host_lock, flags);
> + Â Â Â } else {
> + Â Â Â Â Â Â Â scsi_ram_execute_command(cmnd);
> + Â Â Â }


Chetan Loke
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/