From patchwork Fri Sep 21 20:31:20 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: 10610935 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68654112B for ; Fri, 21 Sep 2018 20:32:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5A1BB2E7A5 for ; Fri, 21 Sep 2018 20:32:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4E99C2E7AC; Fri, 21 Sep 2018 20:32:00 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 EB4922E7B1 for ; Fri, 21 Sep 2018 20:31:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391458AbeIVCWa (ORCPT ); Fri, 21 Sep 2018 22:22:30 -0400 Received: from com-out001.mailprotect.be ([83.217.72.83]:60103 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391279AbeIVCWa (ORCPT ); Fri, 21 Sep 2018 22:22:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=5MZ98/YuNnpGX6FEnII+cK+WDhjhw0Hu/YAjaOEFPxc=; b=qJDxt77kIJRx 7zDM5IYtndCpMNEgzcJqy2hg2i/uwIpURMPESHavI0HQBfQd1ZQh8g9cnPqjQVXHTAWbw02eNere/ PbQmCBcEYhb9fSjJOJb6ZXFoVmYGyHaP1K2UaHUUlgfvlkkQVKEvGqzH+W/28JK804jVisK3ovv/A TvYAicAFdzKCHdp15W+n24FYxstjL2Ilt7oXKZU1aDxmrHymL+EeOBgGnQ1R03VCNqWCfkkNmeg7E LA/YT1YvaUf6v7lWz9yO6OQvK5OeoW5ounNBY+Ulf5hvB+B1cJRdjLuetrUqpnlB/FLmB9uigHeDC yzAy2YVybhE+/zpVgNyrAg==; Received: from smtp-auth.mailprotect.be ([178.208.39.159]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g3S5f-0009bZ-2L; Fri, 21 Sep 2018 22:31:51 +0200 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 44894C05F3; Fri, 21 Sep 2018 22:31:49 +0200 (CEST) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Ming Lei , Jianchao Wang , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH v10 6/8] block: Allow unfreezing of a queue while requests are in progress Date: Fri, 21 Sep 2018 13:31:20 -0700 Message-Id: <20180921203122.49743-7-bvanassche@acm.org> X-Mailer: git-send-email 2.19.0.444.g18242da7ef-goog In-Reply-To: <20180921203122.49743-1-bvanassche@acm.org> References: <20180921203122.49743-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.159 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.03) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5s2M5byl259dygN0qfouYmF602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTaOqZpfO3PVJjdazu3l6Zm3CrxbKqqxVb1b/D8J7mjn9ilV cTJ2PzGYt6C/dLANFNC9eBrzwetNxEiSKDRqnfKMchy245qaCGq3TeWvoSybAt5ZBZ2f8Z/psVOj OL3ZCmxiDKqBZt+RmZBAoK6NQJjatZsKsQQxQNar1gzy+f7dghxsyhtVAWyLP3sCt0cP4c90DckQ p81EoIRVnif+ZCSpuIT8+r21d2ysG4QOmSMH+Myb0lkrtcxVaFvGo4dXB/td3FLLN5JZzRmnU7SU HT2Pg8CBO1Snvm6qXHQp7O9kdbQ+474EzD6sfFobF2lAMMCyNKvOeLJBg69UhVs/U6xGLnQKyOOd NV2reR3vzxDXNzDt3skp6X1z4vnXAvsYlMbwgn3cxqjQiWJvLJ1LCTkYmgjCa8Q0z411CtB1U74U b4SbE1l0jCSqwqiEbnL4lT6XNt7k/jXBfxoamvCeW5qopzvAXfuA7SfJzjMYMU+vzUVrS0dDJ9gE sqV0wk3wKYrFWT1ROcYC8FxG576lHCGHFcRKBISRf9a0jSltkT5XdqQBJ7TPMihJUfmPOEFZaWMM jrqI2oiAXuQ1HJi38ET1Xj3gjnaj+6UA0UPkADHoS6gJylT+GdeVzzo8fCPU9s2+535SEn7rjFiH ERuQKNS8cfLzgKjV3TvSCt4dHaL//xnjPwBm5a6SZT1RnRFVD4MQj9ejTvZ0kbZy5ajP///WmkqY ttGnmHCh3YkGrrS+ZrB5qPrmLnSSifG4ucd7W6Xjp4wBeJ1bBzmy0cHdoxBslkCwablXWKJdZmLa wOg0zuxHfQnEW59lGakD4hu0EVRQvy23SZXSfMZ7RzHGH1l2CmFPje6vvfYmo/29qbgmYbsPb0CG cZbJ6DfC97oi/43JQ3+6q4AlHWfFiKC1INpQMsHcYox7c7ZsoYwS+KCiB8pTPkce0ip05dLwfzN0 WaDweGoFjgVERfb2WRDymz+2tgZkcRkCnoMzps1w8ZlyWgD9hJfBmJfMRsiZuwnxy0yeAs6tSdE8 TNQC3wbhPzhsZyCgxZHINA6A5+7T9o6by3fyJMzeSPO4me587e7DP/mB4b82Bi5RHSD5admVNAUi ewe6zWtZQMrfF7bZB6+xNjEvuGslKTrRIXcXpFg5ivY= X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be 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 A later patch will call blk_freeze_queue_start() followed by blk_mq_unfreeze_queue() without waiting for q_usage_counter to drop to zero. Make sure that this doesn't cause a kernel warning to appear by switching from percpu_ref_reinit() to percpu_ref_resurrect(). The former namely requires that the refcount it operates on is zero. Signed-off-by: Bart Van Assche Cc: Christoph Hellwig Cc: Ming Lei Cc: Jianchao Wang Cc: Hannes Reinecke Cc: Johannes Thumshirn Reviewed-by: Christoph Hellwig --- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 85a1c1a59c72..96d501e8663c 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -198,7 +198,7 @@ void blk_mq_unfreeze_queue(struct request_queue *q) freeze_depth = atomic_dec_return(&q->mq_freeze_depth); WARN_ON_ONCE(freeze_depth < 0); if (!freeze_depth) { - percpu_ref_reinit(&q->q_usage_counter); + percpu_ref_resurrect(&q->q_usage_counter); wake_up_all(&q->mq_freeze_wq); } }