Re: [BUG] Oops when SCSI device under multipath is removed
From: James Bottomley
Date: Wed Aug 10 2011 - 15:52:24 EST
On Wed, 2011-08-10 at 13:29 +0900, Jun'ichi Nomura wrote:
> Hi James,
> With the attached shell script, blk_insert_cloned_request will cause
> oops with 3.1-rc1. (This is a regression introduced in 2.6.39)
> The regression was introduced by 86cbfb5607d4b81b1a993ff689bbd2addd5d3a9b,
> "[SCSI] put stricter guards on queue dead checks".
> Part of the commit has moved scsi_free_queue(), which calls
> blk_cleanup_queue(), to scsi_remove_device(), which is called while
> the device is still open.
> The oops occurs because blk_insert_cloned_request() is called
> after blk_cleanup_queue() is called (which frees elevator
> and turns on QUEUE_FLAG_DEAD).
> 2 patches have been proposed but neither of them included:
> 1) Add QUEUE_FLAG_DEAD check in blk_insert_cloned_request()
> 2) SCSI to call blk_cleanup_queue() from device's ->release() callback
> (before 2.6.39, it used to work like this)
Well, they both have documented objections. I asked why we destroy the
elevator in the del case and didn't get any traction, so let me show the
actual patch which should fix all of these issues.
Is there a good reason for not doing this as a bug fix now?
diff --git a/block/blk-core.c b/block/blk-core.c
index b627558..cc72b7d 100644
@@ -367,11 +367,6 @@ void blk_cleanup_queue(struct request_queue *q)
- if (q->elevator)
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 0ee17b5..a5a756b 100644
@@ -477,6 +477,11 @@ static void blk_release_queue(struct kobject *kobj)
+ if (q->elevator)
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/