From patchwork Wed Aug 10 19:52:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Bottomley X-Patchwork-Id: 1054792 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7AJthWS003542 for ; Wed, 10 Aug 2011 19:56:04 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7AJqPrd002803; Wed, 10 Aug 2011 15:52:27 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7AJqP5i028757 for ; Wed, 10 Aug 2011 15:52:25 -0400 Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7AJqJXf025224 for ; Wed, 10 Aug 2011 15:52:20 -0400 Received: from bedivere.hansenpartnership.com (bedivere.hansenpartnership.com [66.63.167.143]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7AJqItw023340 for ; Wed, 10 Aug 2011 15:52:19 -0400 Received: from localhost (localhost [127.0.0.1]) by bedivere.hansenpartnership.com (Postfix) with ESMTP id 813FA8EE0A2; Wed, 10 Aug 2011 12:52:18 -0700 (PDT) Received: from bedivere.hansenpartnership.com ([127.0.0.1]) by localhost (bedivere.hansenpartnership.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WmzDAd4MH5DM; Wed, 10 Aug 2011 12:52:18 -0700 (PDT) Received: from [192.168.2.10] (dagonet.hansenpartnership.com [76.243.235.53]) by bedivere.hansenpartnership.com (Postfix) with ESMTPSA id 89ADA8EE084; Wed, 10 Aug 2011 12:52:17 -0700 (PDT) From: James Bottomley To: "Jun'ichi Nomura" In-Reply-To: <4E420941.3080601@ce.jp.nec.com> References: <4E420941.3080601@ce.jp.nec.com> Date: Wed, 10 Aug 2011 14:52:13 -0500 Message-ID: <1313005933.2785.12.camel@mulgrave> Mime-Version: 1.0 X-RedHat-Spam-Score: -0.811 (RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.16 X-loop: dm-devel@redhat.com Cc: Kiyoshi Ueda , linux-scsi@vger.kernel.org, jaxboe@fusionio.com, "linux-kernel@vger.kernel.org" , roland@purestorage.com, device-mapper development , stern@rowland.harvard.edu Subject: Re: [dm-devel] [BUG] Oops when SCSI device under multipath is removed X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 10 Aug 2011 19:56:04 +0000 (UTC) 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 --- -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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);