Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3868203pxb; Tue, 17 Nov 2020 05:48:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx91X5FJ3fMWEJG6JgY5dEQeF0ly1IN9dzYX7S8cooXpGeQ940pPMRj55HYdWke89zs3qDT X-Received: by 2002:a17:906:9459:: with SMTP id z25mr19845493ejx.88.1605620890839; Tue, 17 Nov 2020 05:48:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605620890; cv=none; d=google.com; s=arc-20160816; b=LN4imcaQ05xf6zjGYqxOaEl+ZOcocYGHWzboSLl8xA4ci/5qQQn4Y4C8bNzKyAR2kO ESm+RDlZFc8+M9Xne4uPmCNAZG4FjISr+TAQjFDKZWLFD2e67Byi9oLu2RWIW+gp88l1 ZCe+RmiUvNy+28Intt6LJ1aIyrCAGlsiUdeSpDpSXwM6eO6hHbm2hutla5ckrmqSEWau e9FcYK2ZTO3yZDvffwRi1h+RPZLAsbGSL0PjlOfnkUH286uorDaiNmmluLrl8RA4Wh7L rDz9Zcn+WsAt+6r3oEmrkw6v0UxNY5opK9j9PHw6dpJzxQVTYHycgpK1SKENUpDaYdim ZNsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B1KeUISxN9W70KT3HqnhMg4X5PZoa/crasVziAv1YRM=; b=z09II0Lh8PNnu0inKzW6s5+UxcJWDJYqPKDvVK74UZubCvYgc3xGv3HKwP27465CHT xefUvz6bgBbMTMCaBBSJZVYeQtPfbrn3i1EnitoKkbHr/UE9UrWXTTBoRWewMDq+pnKa yZdEmWR/uIAtsDUPQuD88kK29L/1ACh1WaXhOav43GK2Fh4TbB6LFS0Of/kSr+AW+YeB lEUy4H8TeizJDMHzSB5H6WpNCuFkGBJgJlOwZSOG1MXISJOILHQnX7rPDfupGNql2aMD dLBhkL+o4ThLM2V4vdrJXX+7Phxt0CJhhHGklTGuC2xCpDI0dGdOOMYI1KqI7tqcd1Rl 2AjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="k/qk5gw+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si15231120edn.268.2020.11.17.05.47.46; Tue, 17 Nov 2020 05:48:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="k/qk5gw+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733237AbgKQNp7 (ORCPT + 99 others); Tue, 17 Nov 2020 08:45:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:50136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732488AbgKQNil (ORCPT ); Tue, 17 Nov 2020 08:38:41 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2E9E52465E; Tue, 17 Nov 2020 13:38:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605620318; bh=mMVwK18t0G0zhE+tOLd8BKUQPmXLFpyIrRhS2BoLkgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k/qk5gw+prt/mxy+eA9IfopvzelG3h8ZiUtkgj7ljEQPpTJ4yZKAda98MX5r66V3D fhbe3ppHr3ZIxHwqFUQl54Ym41LPRhawfDa4YNf6HZ8nPXb5BKH56uxe6gGuswPpnS 7/Ez4iA2nOzXF7J308TCfu3l4qzLq+/5d9Y1OpiI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Keith Busch , Damien Le Moal , Sasha Levin Subject: [PATCH 5.9 178/255] nvme: freeze the queue over ->lba_shift updates Date: Tue, 17 Nov 2020 14:05:18 +0100 Message-Id: <20201117122147.591803039@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122138.925150709@linuxfoundation.org> References: <20201117122138.925150709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f9d5f4579feafa721dba2f350fc064a1852c6f8c ] Ensure that there can't be any I/O in flight went we change the disk geometry in nvme_update_ns_info, most notable the LBA size by lifting the queue free from nvme_update_disk_info into the caller Signed-off-by: Christoph Hellwig Reviewed-by: Keith Busch Reviewed-by: Damien Le Moal Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index be0cec51f5e6d..b130696b00592 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2001,7 +2001,7 @@ static void nvme_update_disk_info(struct gendisk *disk, /* unsupported block size, set capacity to 0 later */ bs = (1 << 9); } - blk_mq_freeze_queue(disk->queue); + blk_integrity_unregister(disk); atomic_bs = phys_bs = bs; @@ -2066,8 +2066,6 @@ static void nvme_update_disk_info(struct gendisk *disk, set_disk_ro(disk, true); else set_disk_ro(disk, false); - - blk_mq_unfreeze_queue(disk->queue); } static inline bool nvme_first_scan(struct gendisk *disk) @@ -2114,6 +2112,7 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) struct nvme_ctrl *ctrl = ns->ctrl; int ret; + blk_mq_freeze_queue(ns->disk->queue); /* * If identify namespace failed, use default 512 byte block size so * block layer can use before failing read/write for 0 capacity. @@ -2131,29 +2130,38 @@ static int __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) dev_warn(ctrl->device, "failed to add zoned namespace:%u ret:%d\n", ns->head->ns_id, ret); - return ret; + goto out_unfreeze; } break; default: dev_warn(ctrl->device, "unknown csi:%u ns:%u\n", ns->head->ids.csi, ns->head->ns_id); - return -ENODEV; + ret = -ENODEV; + goto out_unfreeze; } ret = nvme_configure_metadata(ns, id); if (ret) - return ret; + goto out_unfreeze; nvme_set_chunk_sectors(ns, id); nvme_update_disk_info(disk, ns, id); + blk_mq_unfreeze_queue(ns->disk->queue); + #ifdef CONFIG_NVME_MULTIPATH if (ns->head->disk) { + blk_mq_freeze_queue(ns->head->disk->queue); nvme_update_disk_info(ns->head->disk, ns, id); blk_stack_limits(&ns->head->disk->queue->limits, &ns->queue->limits, 0); nvme_mpath_update_disk_size(ns->head->disk); + blk_mq_unfreeze_queue(ns->head->disk->queue); } #endif return 0; + +out_unfreeze: + blk_mq_unfreeze_queue(ns->disk->queue); + return ret; } static int _nvme_revalidate_disk(struct gendisk *disk) -- 2.27.0