RE: oops with USB Storage on 2.6.14

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2005-11-08 at 11:24 -0500, goggin, edward wrote:
> ! 	struct scsi_device *sdev = cmd->device;
> ! 	struct request_queue *q = sdev->request_queue;
> ! 
> ! 	// need to hold a reference on the device before we let go of the
> cmd
> ! 	if (scsi_device_get(sdev)) {
> ! 		scsi_put_command(cmd);
> ! 		return;		// maybe sdev_state == SDEV_CANCEL, SDEV_DEL
> ! 	}
>   
>   	scsi_put_command(cmd);
>   	scsi_run_queue(q);
> + 
> + 	// ok to remove device now
> + 	scsi_device_put(sdev);

This is the right idea, I think, but not necessarily the right fix.
scsi_device_get() will fail if the device is going offline, but we would
still need to run the queues.

try this sequence instead:

get_device(&sdev->sdev_gendev);
scsi_put_command(cmd);
scsi_run_queue(q);
put_device(&sdev->sdev_gendev);

James


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux