diff options
author | Bart Van Assche <bvanassche@acm.org> | 2011-09-23 19:48:18 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-11 09:37:02 -0800 |
commit | 8fa9474347f32c7991adc1271e6f34e01479dd31 (patch) | |
tree | 12decd3d6a68f59ec337c4c565c7e0d77139e67e /drivers/scsi/scsi_lib.c | |
parent | 51b702dc3de6c2b5ba3c091f755271776bce7ee4 (diff) | |
download | kernel_samsung_crespo-8fa9474347f32c7991adc1271e6f34e01479dd31.zip kernel_samsung_crespo-8fa9474347f32c7991adc1271e6f34e01479dd31.tar.gz kernel_samsung_crespo-8fa9474347f32c7991adc1271e6f34e01479dd31.tar.bz2 |
Make scsi_free_queue() kill pending SCSI commands
commit 3308511c93e6ad0d3c58984ecd6e5e57f96b12c8 upstream.
Make sure that SCSI device removal via scsi_remove_host() does finish
all pending SCSI commands. Currently that's not the case and hence
removal of a SCSI host during I/O can cause a deadlock. See also
"blkdev_issue_discard() hangs forever if underlying storage device is
removed" (http://bugzilla.kernel.org/show_bug.cgi?id=40472). See also
http://lkml.org/lkml/2011/8/27/6.
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r-- | drivers/scsi/scsi_lib.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 28d9c9d..f97acff 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1697,6 +1697,15 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev) void scsi_free_queue(struct request_queue *q) { + unsigned long flags; + + WARN_ON(q->queuedata); + + /* cause scsi_request_fn() to kill all non-finished requests */ + spin_lock_irqsave(q->queue_lock, flags); + q->request_fn(q); + spin_unlock_irqrestore(q->queue_lock, flags); + blk_cleanup_queue(q); } |