From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39491196DA8; Thu, 6 Jun 2024 14:10:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683021; cv=none; b=XTzZ6oN7ZarDfizGfhVR1Dji6Hk1BU7+1VpF00UgShiZdQBIG2hjwnXW/TmycCp8yMVfpsHDKWU23ag3X3USz2GuaJ+ODz63DUaIK5Oy4d9yOqoEySeHxfn463d52vsXpGMgbbM3+pS17M9p6AI4vdHc2LE57Gpb6oZPPSh7Hj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683021; c=relaxed/simple; bh=5AwBnkkR9j2/aX5Rt5fu+Atsut4cCSipkkmY2THQMGo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nuR1T3nGzeCLR6/psr7D3szC4k4PANrl5Yfrpfoga6UanHfWoZNH+gr+/5p74q/1Z6za1VAqEfchNvT1ArCOJ//XD1YE/gOqEf6RDhY/pHUWrO26+0LkrXLGVgWcZB1b//hgPDbFBC326LFQC5jNpNIGK7tnUCWgQLAGPM7Vapo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=u0KzzzFQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="u0KzzzFQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 156C7C32781; Thu, 6 Jun 2024 14:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1717683021; bh=5AwBnkkR9j2/aX5Rt5fu+Atsut4cCSipkkmY2THQMGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u0KzzzFQm8TUZZPRV6WAlA5mJjQHmDA945nH+nh/FdxBw+MgN8LutTelTGMZNf439 PO7y80hQixeymAcQEe0hg0KM6qJhF2BDwA5RMx8SzsKwhE7pZzXo0ik8Yh1ighxNfD SupEu2O9FkSODLljMvvgjSsdgWX+C+qcoD/Rao14= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sagi Grimberg , Dan Aloni , Sagi Grimberg , Chuck Lever , Trond Myklebust , Sasha Levin Subject: [PATCH 6.9 242/374] rpcrdma: fix handling for RDMA_CM_EVENT_DEVICE_REMOVAL Date: Thu, 6 Jun 2024 16:03:41 +0200 Message-ID: <20240606131659.926784211@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240606131651.683718371@linuxfoundation.org> References: <20240606131651.683718371@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Aloni [ Upstream commit 4836da219781ec510c4c0303df901aa643507a7a ] Under the scenario of IB device bonding, when bringing down one of the ports, or all ports, we saw xprtrdma entering a non-recoverable state where it is not even possible to complete the disconnect and shut it down the mount, requiring a reboot. Following debug, we saw that transport connect never ended after receiving the RDMA_CM_EVENT_DEVICE_REMOVAL callback. The DEVICE_REMOVAL callback is irrespective of whether the CM_ID is connected, and ESTABLISHED may not have happened. So need to work with each of these states accordingly. Fixes: 2acc5cae2923 ('xprtrdma: Prevent dereferencing r_xprt->rx_ep after it is freed') Cc: Sagi Grimberg Signed-off-by: Dan Aloni Reviewed-by: Sagi Grimberg Reviewed-by: Chuck Lever Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- net/sunrpc/xprtrdma/verbs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index 4f8d7efa469f0..432557a553e7e 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c @@ -244,7 +244,11 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event) case RDMA_CM_EVENT_DEVICE_REMOVAL: pr_info("rpcrdma: removing device %s for %pISpc\n", ep->re_id->device->name, sap); - fallthrough; + switch (xchg(&ep->re_connect_status, -ENODEV)) { + case 0: goto wake_connect_worker; + case 1: goto disconnected; + } + return 0; case RDMA_CM_EVENT_ADDR_CHANGE: ep->re_connect_status = -ENODEV; goto disconnected; -- 2.43.0