From patchwork Wed Feb 27 14:48:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 2193531 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork1.kernel.org (Postfix) with ESMTP id 6CD223FD4E for ; Wed, 27 Feb 2013 14:50:53 +0000 (UTC) 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 r1REmGP3002408; Wed, 27 Feb 2013 09:48:16 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r1REmFNF005907 for ; Wed, 27 Feb 2013 09:48:15 -0500 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r1REmFoF017786 for ; Wed, 27 Feb 2013 09:48:15 -0500 Received: from jacques.telenet-ops.be (jacques.telenet-ops.be [195.130.132.50]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r1REl8pM020022 for ; Wed, 27 Feb 2013 09:48:07 -0500 Received: from [192.168.1.102] ([178.119.235.68]) by jacques.telenet-ops.be with bizsmtp id 5So71l00K1VD9XW0JSo7C1; Wed, 27 Feb 2013 15:48:07 +0100 Message-ID: <512E1CA7.1030404@acm.org> Date: Wed, 27 Feb 2013 15:48:07 +0100 From: Bart Van Assche User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3 MIME-Version: 1.0 To: device-mapper development , linux-scsi References: <512E1C06.2000903@acm.org> In-Reply-To: <512E1C06.2000903@acm.org> X-RedHat-Spam-Score: -2.311 (BAYES_00, DCC_REPUT_00_12, RCVD_IN_DNSWL_NONE, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.21 X-loop: dm-devel@redhat.com Cc: Jens Axboe , Mike Snitzer , James Bottomley , "Jun'ichi Nomura" , Tejun Heo , Alasdair G Kergon Subject: [dm-devel] [PATCH v2 2/2] dm: Avoid running the md queue after the last dm_put() 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 At least in theory the mapped device can disappear after rq_completed() has invoked dm_put() and before the queue of the mapped device has been run. Avoid this by running the queue synchronously instead of asynchronously. Note: the previous patch makes invoking blk_run_queue() from inside dm_request_fn() safe. Signed-off-by: Bart Van Assche Cc: Alasdair G Kergon Cc: Jens Axboe Cc: Mike Snitzer Cc: Tejun Heo Cc: James Bottomley Cc: Jun'ichi Nomura --- drivers/md/dm.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 314a0e2..28b7ad4 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -728,14 +728,8 @@ static void rq_completed(struct mapped_device *md, int rw, int run_queue) if (!md_in_flight(md)) wake_up(&md->wait); - /* - * Run this off this callpath, as drivers could invoke end_io while - * inside their request_fn (and holding the queue lock). Calling - * back into ->request_fn() could deadlock attempting to grab the - * queue lock again. - */ if (run_queue) - blk_run_queue_async(md->queue); + blk_run_queue(md->queue); /* * dm_put() must be at the end of this function. See the comment above