From patchwork Thu Jan 11 20:14:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 10158489 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 B158460170 for ; Thu, 11 Jan 2018 20:14:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A613822B1F for ; Thu, 11 Jan 2018 20:14:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AF48279E0; Thu, 11 Jan 2018 20:14:30 +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.9 required=2.0 tests=BAYES_00,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 1FB1722B1F for ; Thu, 11 Jan 2018 20:14:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932332AbeAKUO3 (ORCPT ); Thu, 11 Jan 2018 15:14:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48770 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932220AbeAKUO3 (ORCPT ); Thu, 11 Jan 2018 15:14:29 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13B82745C6; Thu, 11 Jan 2018 20:14:29 +0000 (UTC) Received: from localhost (unknown [10.16.197.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B05C98509; Thu, 11 Jan 2018 20:14:26 +0000 (UTC) From: Mike Snitzer To: axboe@kernel.dk Cc: Ming Lei , hare@suse.de, Bart.VanAssche@wdc.com, dm-devel@redhat.com, linux-block@vger.kernel.org Subject: [for-4.16 PATCH v4 2/4] block: use queue_lock when clearing QUEUE_FLAG_REGISTERED in blk_unregister_queue Date: Thu, 11 Jan 2018 15:14:15 -0500 Message-Id: <20180111201417.2042-3-snitzer@redhat.com> In-Reply-To: <20180111201417.2042-1-snitzer@redhat.com> References: <20180111201417.2042-1-snitzer@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 11 Jan 2018 20:14:29 +0000 (UTC) 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 blk_unregister_queue() must protect against any modifications of q->queue_flags (not just those performed in blk-sysfs.c). Therefore q->queue_lock needs to be used rather than q->sysfs_lock. Fixes: e9a823fb34a8b ("block: fix warning when I/O elevator is changed as request_queue is being removed") Cc: stable@vger.kernel.org # 4.14+ Reported-by: Bart Van Assche Signed-off-by: Mike Snitzer --- block/blk-sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 870484eaed1f..52f57539f1c7 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -929,9 +929,9 @@ void blk_unregister_queue(struct gendisk *disk) if (WARN_ON(!q)) return; - mutex_lock(&q->sysfs_lock); + spin_lock_irq(q->queue_lock); queue_flag_clear_unlocked(QUEUE_FLAG_REGISTERED, q); - mutex_unlock(&q->sysfs_lock); + spin_unlock_irq(q->queue_lock); wbt_exit(q);