From patchwork Wed Feb 28 00:28:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10246425 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE9F860362 for ; Wed, 28 Feb 2018 00:28:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA6D72881A for ; Wed, 28 Feb 2018 00:28:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC70D28B1F; Wed, 28 Feb 2018 00:28:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1DF532881A for ; Wed, 28 Feb 2018 00:28:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751516AbeB1A2c (ORCPT ); Tue, 27 Feb 2018 19:28:32 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:46883 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751304AbeB1A2b (ORCPT ); Tue, 27 Feb 2018 19:28:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1519777711; x=1551313711; h=from:to:cc:subject:date:message-id; bh=eFWD7H7ypjdwrBcxWyQBArG6/wyZfkLhX2IqkSwVjoc=; b=H+/YzfP6Jko6E3rYEpSlTlyDYaklS9fGBX/YEUtSNjwIj7UV/1cze0oD ti3ZiaxwfaGdPNfIhU8CRCEb3YwXHPUXAFE7m0qZGqsVXpdcoaZY862+3 HO4pSzO7kvaSt7c6tkKkix7TsRZhOMLN8PTdGX4VNN3cR4vmDdLp6OcuI 07aS1oQLebbKmqeaEix8PuVtj7315iJL3X0G/oDf+oWSR/4iiwffnuFrm AOKmZ2abKKIrMpzG6yeTZ2/oydLiTijsBfNwHsUPRgAgSaaBySRZgb+Pd fUG0AY1D5GzQKJEPuWgpfMU+KkubF2OVc9Ya7l5GZo+iEeP+a6h9GHafi A==; X-IronPort-AV: E=Sophos;i="5.47,403,1515427200"; d="scan'208";a="72500466" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 28 Feb 2018 08:28:31 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 27 Feb 2018 16:21:57 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.46.240]) by uls-op-cesaip02.wdc.com with ESMTP; 27 Feb 2018 16:28:31 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Damien Le Moal , Hannes Reinecke , Ming Lei Subject: [PATCH] blk-mq: Make sure that the affected zone is unlocked if a request times out Date: Tue, 27 Feb 2018 16:28:30 -0800 Message-Id: <20180228002830.3052-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If a request times out the .completed_request() method is not called and the .finish_request() method is only called if RQF_ELVPRIV has been set. Hence this patch that sets RQF_ELVPRIV and that adds a .finish_request() method. Without this patch, if a request times out the zone that request applies to remains locked forever and no further writes are accepted for that zone. Fixes: 5700f69178e9 ("mq-deadline: Introduce zone locking support") Signed-off-by: Damien Le Moal Signed-off-by: Bart Van Assche Cc: Hannes Reinecke Cc: Ming Lei --- block/mq-deadline.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/block/mq-deadline.c b/block/mq-deadline.c index c56f211c8440..55d5b7a02d62 100644 --- a/block/mq-deadline.c +++ b/block/mq-deadline.c @@ -367,7 +367,8 @@ static struct request *__dd_dispatch_request(struct deadline_data *dd) * If the request needs its target zone locked, do it. */ blk_req_zone_write_lock(rq); - rq->rq_flags |= RQF_STARTED; + /* Set RQF_ELVPRIV to ensure that .finish_request() gets called */ + rq->rq_flags |= RQF_STARTED | RQF_ELVPRIV; return rq; } @@ -539,7 +540,9 @@ static void dd_insert_requests(struct blk_mq_hw_ctx *hctx, * For zoned block devices, write unlock the target zone of * completed write requests. Do this while holding the zone lock * spinlock so that the zone is never unlocked while deadline_fifo_request() - * while deadline_next_request() are executing. + * while deadline_next_request() are executing. This function is called twice + * for requests that complete in a normal way and once for requests that time + * out. */ static void dd_completed_request(struct request *rq) { @@ -757,6 +760,7 @@ static struct elevator_type mq_deadline = { .insert_requests = dd_insert_requests, .dispatch_request = dd_dispatch_request, .completed_request = dd_completed_request, + .finish_request = dd_completed_request, .next_request = elv_rb_latter_request, .former_request = elv_rb_former_request, .bio_merge = dd_bio_merge,