From patchwork Wed Sep 26 21:01:08 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: 10616815 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 863B415A6 for ; Wed, 26 Sep 2018 21:01:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78BB32B86C for ; Wed, 26 Sep 2018 21:01:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CE922B879; Wed, 26 Sep 2018 21:01:46 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 DE0432B86C for ; Wed, 26 Sep 2018 21:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726107AbeI0DQd (ORCPT ); Wed, 26 Sep 2018 23:16:33 -0400 Received: from out002.mailprotect.be ([83.217.72.86]:38727 "EHLO out002.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726778AbeI0DQd (ORCPT ); Wed, 26 Sep 2018 23:16:33 -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=q4rx56HlzfQWPmgUMNgD+dZUKP3vcxLqqv9uiYS7+IQ=; b=kLZovlGqURcR kLPcEYWjIUAlkilgMZ8NU2BIK/KgML9zojnHguDmJLa+OloxYQZf9CIf2FELiA4qqyyha3GRaH3i5 FtRF27Up/7EhymZZykij5/QLmWt20apFOwId59UI1eXqgA+u1qdV4eijYAofV7siBrmh7NdFPfMpS UZ+yl6t39t8QfYPnO+g9uuNIZrb5gCPCYiThRyfApSS4ZY/WMN0bZffUtS/IGSekdbLHULYSYhwux YzoTpaxddHcnkDwF4HimdPK77LfLUrjJI98jmhyUdAjvyHqoNrZH4JmKg0Nuhgr+kqtiZ+wyA35fF hPTth/Tl9iL48tPFpoHYTg==; Received: from smtp-auth.mailprotect.be ([178.208.39.159]) by com-mpt-out002.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1g5GwD-000BmJ-RN; Wed, 26 Sep 2018 23:01:38 +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 EBD23C0690; Wed, 26 Sep 2018 23:01:29 +0200 (CEST) From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Jianchao Wang , Hannes Reinecke , Johannes Thumshirn Subject: [PATCH v11 6/8] block: Allow unfreezing of a queue while requests are in progress Date: Wed, 26 Sep 2018 14:01:08 -0700 Message-Id: <20180926210110.20362-7-bvanassche@acm.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20180926210110.20362-1-bvanassche@acm.org> References: <20180926210110.20362-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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u9hECzjHVJYm zB0wNFwKBhAh7NeKYzwwwYGpIXFoD3qBQ/+jD8DnbY4P22mARozswtw2zJlBnPnfa0dz8Ne0ck6P 4ivKdWmRJx+gN88F2PY5Qd/IVA8Jo8TFp7yCKYHAkCy5d3koL3/Zyry2SweqbjhutBuGyPj/pbiB 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 Reviewed-by: Ming Lei Reviewed-by: Christoph Hellwig Cc: Jianchao Wang Cc: Hannes Reinecke Cc: Johannes Thumshirn --- 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); } }