Stop accepting SCSI requests before removing a device
authorBart Van Assche <bvanassche@acm.org>
Fri, 29 Jun 2012 15:36:07 +0000 (15:36 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 11 Jul 2014 12:33:55 +0000 (13:33 +0100)
commitb5a10549d528827aa331c1d95a6170032718babe
tree16370e1ca1bda04de9b183302b82c801358eaa31
parent3f5ec1a1dc36df4e56656e21ad4a02048bc101b9
Stop accepting SCSI requests before removing a device

commit b485462aca7df4e32bcf7efb6f84a69e8b640243 upstream.

Avoid that the code for requeueing SCSI requests triggers a
crash by making sure that that code isn't scheduled anymore
after a device has been removed.

Also, source code inspection of __scsi_remove_device() revealed
a race condition in this function: no new SCSI requests must be
accepted for a SCSI device after device removal started.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_sysfs.c