From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: "Jun'ichi Nomura" <j-nomura@ce.jp.nec.com>
Cc: jaxboe@fusionio.com, roland@purestorage.com,
stern@rowland.harvard.edu, linux-scsi@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
device-mapper development <dm-devel@redhat.com>,
Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Subject: Re: [BUG] Oops when SCSI device under multipath is removed
Date: Wed, 10 Aug 2011 14:52:13 -0500 [thread overview]
Message-ID: <1313005933.2785.12.camel@mulgrave> (raw)
In-Reply-To: <4E420941.3080601@ce.jp.nec.com>
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()
> https://lkml.org/lkml/2011/7/8/457
> 2) SCSI to call blk_cleanup_queue() from device's ->release() callback
> (before 2.6.39, it used to work like this)
> https://lkml.org/lkml/2011/7/2/106
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?
James
---
diff --git a/block/blk-core.c b/block/blk-core.c
index b627558..cc72b7d 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -367,11 +367,6 @@ void blk_cleanup_queue(struct request_queue *q)
queue_flag_set_unlocked(QUEUE_FLAG_DEAD, q);
mutex_unlock(&q->sysfs_lock);
- if (q->elevator)
- elevator_exit(q->elevator);
-
- blk_throtl_exit(q);
-
blk_put_queue(q);
}
EXPORT_SYMBOL(blk_cleanup_queue);
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 0ee17b5..a5a756b 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -477,6 +477,11 @@ static void blk_release_queue(struct kobject *kobj)
blk_sync_queue(q);
+ if (q->elevator)
+ elevator_exit(q->elevator);
+
+ blk_throtl_exit(q);
+
if (rl->rq_pool)
mempool_destroy(rl->rq_pool);
next prev parent reply other threads:[~2011-08-10 19:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-10 4:29 [BUG] Oops when SCSI device under multipath is removed Jun'ichi Nomura
2011-08-10 19:52 ` James Bottomley [this message]
2011-08-11 0:24 ` Jun'ichi Nomura
2011-08-11 3:01 ` Jun'ichi Nomura
2011-08-11 14:33 ` James Bottomley
2011-08-11 14:59 ` Alan Stern
2011-08-11 15:05 ` James Bottomley
2011-08-11 15:16 ` Alan Stern
2011-08-16 11:26 ` Jun'ichi Nomura
2011-08-18 9:11 ` Jun'ichi Nomura
2011-08-31 19:50 ` Thadeu Lima de Souza Cascardo
2011-09-08 0:00 ` Jun'ichi Nomura
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1313005933.2785.12.camel@mulgrave \
--to=james.bottomley@hansenpartnership.com \
--cc=dm-devel@redhat.com \
--cc=j-nomura@ce.jp.nec.com \
--cc=jaxboe@fusionio.com \
--cc=k-ueda@ct.jp.nec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=roland@purestorage.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox