Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4092398ybe; Mon, 9 Sep 2019 04:10:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/Rsgr+ppqHKFO+KCGghtkMIuLNf47GzVVrb7GNkISJF1TdbK+fTagC0pQPLCCDLdZM6fh X-Received: by 2002:a17:906:ce56:: with SMTP id se22mr18715906ejb.72.1568027431626; Mon, 09 Sep 2019 04:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568027431; cv=none; d=google.com; s=arc-20160816; b=JK54lZ6jlmCNzUF2LN3aLPWTGsHrOUH/g2ZCdsX3N2yXRM+Rv6P6ByjPf+T5la6pMT Qg7OYC1OOa6xBAUDxGgyFFT6LQAUuf0bgTYwrTHUmnJbNqJO8LGmtAxp5hl8yDm7cPX2 3c3JVCrlKCByMR1zWZTZilKICvRxbR2VnIyXc/P/3K7XX2SobyBe38V5Fq/nTY1z9f4a pdhzR7X6RLNgfBA587eT5ksN+IEA8vLNcQdCzNwUziwKgNFge7HaHcC7t7rla1EVz4O0 5sg9g178DYZELDgrwzNF3C7iksuHZTWRS9teNWH9OoI/pFoT/+PohqrRbvjqRwr8Jvms rRmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ioZFu/sA3nwSjbB0UMaNjZQL4YdkRUx7Tpv88oHc9Jg=; b=f04u99mMzNzCRIKGFSn+ype+20QZ51QSq1S9rN/6w0UyxdCoHGGElJz7TG6UdIDeTG gv6msr2aGklmj1tTN+MSa6wcBW5uKfO1PRoozP8VeYpPZ8gAgzihE1s5VHu1SciXj2Qj LjfNwXILW3fL7cwR/D0Ej5ixW9mHWtnz7fLjPWXmMEhX4fS5LdzFUAyKS4/QxTD9h9DG G2nbMM6BYSZx4GevZ1sBB+BSZdsEOK/5eeF0pU4RK1XgAhQHPl05o3K2aoL8lV4ciN2p sOL8+msnR+fqXm4peHKiW0mL2T1hQZDkNkQfVyONpMvWAKw/dNQBfSip6+YSNcj2G93O ZTdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bryIcsCH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si7157280ejc.84.2019.09.09.04.10.06; Mon, 09 Sep 2019 04:10:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bryIcsCH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731023AbfIHMs0 (ORCPT + 99 others); Sun, 8 Sep 2019 08:48:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:37396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730963AbfIHMsT (ORCPT ); Sun, 8 Sep 2019 08:48:19 -0400 Received: from localhost (unknown [62.28.240.114]) (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 F021C218AC; Sun, 8 Sep 2019 12:48:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567946899; bh=bYNoIsYH8WNrjujjR32MTckT4/nfiXejLG6XX+LltxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bryIcsCHNDvibD79cml9zjilpuU6NSOO82J3WmfqUyh/3lfseADDLsQptn/C0tfAP /4djmVT+wj5QaWFhG/2luv7n+8t6RkGHNIG7TChdyNO7qM4CxXvj83VxNY+3ercKYh 7mmk0NhA3mRw7CTt0s1cJ14AQDSNk+GjYoRAfdDw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Anton Eidelman , Sagi Grimberg , Jens Axboe , Sasha Levin Subject: [PATCH 4.19 43/57] nvme-multipath: fix possible I/O hang when paths are updated Date: Sun, 8 Sep 2019 13:42:07 +0100 Message-Id: <20190908121144.811442789@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190908121125.608195329@linuxfoundation.org> References: <20190908121125.608195329@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 504db087aaccdb32af61539916409f7dca31ceb5 ] nvme_state_set_live() making a path available triggers requeue_work in order to resubmit requests that ended up on requeue_list when no paths were available. This requeue_work may race with concurrent nvme_ns_head_make_request() that do not observe the live path yet. Such concurrent requests may by made by either: - New IO submission. - Requeue_work triggered by nvme_failover_req() or another ana_work. A race may cause requeue_work capture the state of requeue_list before more requests get onto the list. These requests will stay on the list forever unless requeue_work is triggered again. In order to prevent such race, nvme_state_set_live() should synchronize_srcu(&head->srcu) before triggering the requeue_work and prevent nvme_ns_head_make_request referencing an old snapshot of the path list. Reviewed-by: Christoph Hellwig Signed-off-by: Anton Eidelman Signed-off-by: Sagi Grimberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/nvme/host/multipath.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 05d6371c7f385..f57feb8fdea45 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -323,6 +323,7 @@ static void nvme_mpath_set_live(struct nvme_ns *ns) "failed to create id group.\n"); } + synchronize_srcu(&ns->head->srcu); kblockd_schedule_work(&ns->head->requeue_work); } -- 2.20.1