Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp854276pxk; Thu, 17 Sep 2020 19:10:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaAhzbR4i8tRh68Q64XAl5S1EV6UCXcamZVc0Q4uLPMO7dr08VbYpfBDGe9FJyYtQCBFEs X-Received: by 2002:aa7:d805:: with SMTP id v5mr36510625edq.29.1600395027958; Thu, 17 Sep 2020 19:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600395027; cv=none; d=google.com; s=arc-20160816; b=OiMEH7tAGzOj5W/3dFMqwui2YRmcwUctQpLhHxhs4sChFJ0A1FwairinssgAgTR6tQ k6OU0XK/hn3FOUXpnGzZ8EBqpd+yEEHcz9I/oK7DK1R93KE/WuZhiC7mgZpSwtr+Q/oB LfQmLh27WlpMOlIM3EyUbton46lJLsTBopxNyy1SZYChe+ECdbewCG2F/70uNXRzJSft bk1WvpNBFXwV9SyUiVp03j1BZirmOaiGt4dvlRslpGoPWVFYRtNIQVv53W2UIHII4se+ iQraRjEIk7qChJ9HCQvM4iwRzvdwuAj8WQWbpTPCEKse2px+oYWWDe6BX6KMWwy4Tztn Dqcw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rwebuo+vqbvnRyI7r0X7Rq8aR3cLEYJbT6WkG4qhUgc=; b=PXAeqvqKJ7QYKsJK/WlorYrtL+L+Wuanr+r2q3Ik7RZ/R6EgUP/PZbsDOJvZ+59E9j apEnDcCF+yxKJ2CU33hcQs0gVKVrtW1e5juANhsrRHGoTA+T/ortUI8d/CBitWqtNwPZ uUlE2LncOTe/u2S+bxF7PwBZRA8j5F06skMSnY6GKmc4hh3FNM8NeTsqDvyuy+C/+wsg EqydkZgb/GEojuYjOTJXhI0dgJoqoGMOAfdkEv8hOmUKEFUInmX67TnuiXISyzUBqoPz 8GlnhaYke1yfoot7jOFzp4ftNlB26uKcga73HbfgGagySk/tuM48gH6HBO5n4daPJgXi ogYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SeMpluox; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g17si1287819ejd.140.2020.09.17.19.10.04; Thu, 17 Sep 2020 19:10:27 -0700 (PDT) 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=SeMpluox; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726708AbgIRCIG (ORCPT + 99 others); Thu, 17 Sep 2020 22:08:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:58824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728030AbgIRCIA (ORCPT ); Thu, 17 Sep 2020 22:08:00 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 52DA82395B; Fri, 18 Sep 2020 02:07:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394880; bh=b0QaQkPQUvGb0i1tDsh+9kqSe2KgUtokEip5fnHtNmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SeMpluox2+GRRmu7XiCVsusUxtes/cVV225EPhMfjzAazUnQ+Lk+5YazVYqVxKUyo xmxSxuqL8sRtm0ldDugDWnvOkJq+nExp6zfOIA0SRxVPvGfV+zMGjAj4sf26K3xlET jVi4U+WKyfKr4Cgtjmxk6Jqv0nAIz3cyYXy+BX78= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Anthony Iliopoulos , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 330/330] nvme: explicitly update mpath disk capacity on revalidation Date: Thu, 17 Sep 2020 22:01:10 -0400 Message-Id: <20200918020110.2063155-330-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anthony Iliopoulos [ Upstream commit 05b29021fba5e725dd385151ef00b6340229b500 ] Commit 3b4b19721ec652 ("nvme: fix possible deadlock when I/O is blocked") reverted multipath head disk revalidation due to deadlocks caused by holding the bd_mutex during revalidate. Updating the multipath disk blockdev size is still required though for userspace to be able to observe any resizing while the device is mounted. Directly update the bdev inode size to avoid unnecessarily holding the bdev->bd_mutex. Fixes: 3b4b19721ec652 ("nvme: fix possible deadlock when I/O is blocked") Signed-off-by: Anthony Iliopoulos Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 1 + drivers/nvme/host/nvme.h | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index bbf52e88f045a..038ef9d113388 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1864,6 +1864,7 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id) if (ns->head->disk) { nvme_update_disk_info(ns->head->disk, ns, id); blk_queue_stack_limits(ns->head->disk->queue, ns->queue); + nvme_mpath_update_disk_size(ns->head->disk); } #endif } diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index 7d57c42a641ca..aab976737f9a9 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -561,6 +561,16 @@ static inline void nvme_trace_bio_complete(struct request *req, req->bio, status); } +static inline void nvme_mpath_update_disk_size(struct gendisk *disk) +{ + struct block_device *bdev = bdget_disk(disk, 0); + + if (bdev) { + bd_set_size(bdev, get_capacity(disk) << SECTOR_SHIFT); + bdput(bdev); + } +} + extern struct device_attribute dev_attr_ana_grpid; extern struct device_attribute dev_attr_ana_state; extern struct device_attribute subsys_attr_iopolicy; @@ -636,6 +646,9 @@ static inline void nvme_mpath_wait_freeze(struct nvme_subsystem *subsys) static inline void nvme_mpath_start_freeze(struct nvme_subsystem *subsys) { } +static inline void nvme_mpath_update_disk_size(struct gendisk *disk) +{ +} #endif /* CONFIG_NVME_MULTIPATH */ #ifdef CONFIG_NVM -- 2.25.1