Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp446673pxb; Wed, 1 Sep 2021 02:28:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeJ5h4NMAVIipgOCKbEUiuzx3g6LUCHEq6ko9xegQZZefTvQ4gK9gVuxhoUwX/irvYQ1If X-Received: by 2002:a5e:da44:: with SMTP id o4mr27074907iop.147.1630488485535; Wed, 01 Sep 2021 02:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630488485; cv=none; d=google.com; s=arc-20160816; b=MjXJMDfBOg2tkD3XqXd+OaPmyXh5asApSLTWXHKbKkKpVkYchJ4v3y0Yzv4OhFemwf 1OliJ9axVhC1SWnINmN7jwBML8rayBOVxc17jRnlFd4cdzbAeGhq18VUJq814GYCLInA ucAHPjqMNQhN3QUfMxy+rpPi9KNN6qa7X33jBsb8d4RJNsa7k6SNi/FV0kjndFA1X/yQ /WeZkmAYZwju546C0oaDzLdi5oSiruEYaUjpJH1lqaQRDVRYIGdRFCnjuEpTi2pRI/nB XNezGAkGdC8dJITzGhw2OZkdEV7gySpokQcgO1Fa1juHv28+yj2XNQ7DLU2XtJdNMSWB W3rA== 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 :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=+YRDyHEd0/BbrJjaiTEJ0u9b/syuNDaZjHPGP+HRcTk=; b=ExbylYafmD5ALO4T8q0OaPFCOz1jj0is2PT8+Ixb3L1q0sTe3PidrtJT3ndP4Lcw1U 46aZ1VS/SfS6RL0TL5DGQ88ph3B506Jw/CodDK+9jJDxZ4T3DPV17hjmq3wt3xgxLHhJ hMRnLUjWE0/ZJ/vvLs+NzfuAFCIUyTOHw7R34NgxlG82Gdd5bmRKUAAfjThCegk32puu kVenY75MfumD/CtHHcm4V/zPyFQezYX1dEeOtF/FrjwZX+HD6WYuA4CYoaKWrmsj4eh2 BfJV0+QJcmquiQKvFSUA3CtTc1aIMF8yfLaa4RmA21XmHxLfx5Owj0QQfEzh3w5A4CTa 6Hjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=gxZAuuRY; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w14si22102038ill.17.2021.09.01.02.27.53; Wed, 01 Sep 2021 02:28:05 -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=@suse.de header.s=susede2_rsa header.b=gxZAuuRY; dkim=neutral (no key) header.i=@suse.de; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243532AbhIAJ00 (ORCPT + 99 others); Wed, 1 Sep 2021 05:26:26 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:60280 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243418AbhIAJ00 (ORCPT ); Wed, 1 Sep 2021 05:26:26 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 1303F1FED2; Wed, 1 Sep 2021 09:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1630488329; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+YRDyHEd0/BbrJjaiTEJ0u9b/syuNDaZjHPGP+HRcTk=; b=gxZAuuRYo4um9VhWmQFpBfBzUkO/Vvk6T+X3j6soRekCeo9n2WkXLR+VdAGXgd69xuIm4+ vu5ihxduiVqWosyO5yVWspxwM3jJoHK7hCoRAmrO6jxIBy/Xd96OIHMExRFscPFV9jJCEj 2pCXl/PbWWkElgsSKnwCGmQkBrLGZjg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1630488329; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=+YRDyHEd0/BbrJjaiTEJ0u9b/syuNDaZjHPGP+HRcTk=; b=Q5ZeS9YcXGgTK6kCB8wv6MUKYl1FiJ9GAlmTRGQnMNpDwnSHEATh6C2MQji69bGpmWYMma EvsNgdyHP2yxXKAQ== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 0D54EA3B9C; Wed, 1 Sep 2021 09:25:29 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 17828) id F3DE5518DE46; Wed, 1 Sep 2021 11:25:28 +0200 (CEST) From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Daniel Wagner Subject: [PATCH v1] nvme: only call synhronize_srcu when clearing current path Date: Wed, 1 Sep 2021 11:25:24 +0200 Message-Id: <20210901092524.131610-1-dwagner@suse.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function nmve_mpath_clear_current_path returns true if the current path has changed. In this case we have to wait for all concurrent submissions to finish. But if we didn't change the current path, there is no point in waiting for another RCU period to finish. Signed-off-by: Daniel Wagner --- drivers/nvme/host/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d3d5cc947525..5b3c74fa89bd 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3814,8 +3814,8 @@ static void nvme_ns_remove(struct nvme_ns *ns) mutex_unlock(&ns->ctrl->subsys->lock); synchronize_rcu(); /* guarantee not available in head->list */ - nvme_mpath_clear_current_path(ns); - synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */ + if (nvme_mpath_clear_current_path(ns)) + synchronize_srcu(&ns->head->srcu); /* wait for concurrent submissions */ if (ns->disk->flags & GENHD_FL_UP) { if (!nvme_ns_head_multipath(ns->head)) -- 2.29.2