From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387206; b=p4IIq4yB/BVq85VXRGlCsyXyZ/edJ2bPlM8eWlWR8bUHeD6fhVo6hd8BXYU9RlTSTpOI Bc/AytGJHgtU1Ui24GVskt30jmqe1hr5yuNCtjMHkMYsqlaTKqFjuQWOs0TGHoR34u3I6 HNl1Kt97f1vlE11/nzcA8uvU03NxZsQMXTf0ulXmT8IY0t0vlEI/U6GQx4ha9oVL37rWk cY50AREGjSY2Fs1MZo9QGKH2fbLe22/JUyinNhXpBAzSHFA5Hgd1GqsWwuuDVBaf6OGnC afqLxvYG0lcTfwDLkVDkZCsuHKaforTxId7yLpIZpCkksWGz8s6h5GNBaqAcp+WWinQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387206; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=/l9BxdpLcdZK612k/+w94zFfiOjDzNAMC/zf7WNWXgo=; b=b1vouCUk5s2llL0LDHgvRYexC3LmxfQcXkpD8jzd8DF6e9S7xK+sDZ4b2xXvsNXVPvss VGB9DVSwII5N7kpBhAOIKWGjbR7VQmBk5rpuBCtc4ZR/mfoVRjm95PRtl+kagedpUzo0x MctX8g2Ym3o3fm+lUh8T3b+fmxbXekMstGWltHjrM0hQJburbkBC5+8mOFeu/5CkhLgqx 8L3DHZKh7zio8B6CKJlKKZN3KXCowXlrgudfuYkKe7BveQWLt71tfjtp9sRphwwLD8n6Y dq7joTA98TzNO02UQDrWeGCMd9gBBAkD8Gs3SQoc46o0ZWfL0GC8ZnAfhhbG04e5VCw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YLBzqxYq; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BC3E606A322; Fri, 4 Dec 2026 12:26:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YLBzqxYq Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD3CC1F000C2; Fri, 4 Dec 2026 12:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387206; bh=/l9BxdpLcdZK612k/+w94zFfiOjDzNAMC/zf7WNWXgo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YLBzqxYq7riTT2g8nSmXH4pITrtgoCbuJzNuojXM7IMdudox2LdIraNa+v2UHb+F2 v6eelHh86irRh06knqNLil0qXRashjF8oIRPXaMykb/KlA0alpzo2AacEF5J/Z+3M+ 9KMb546Jcye9ADkYhRr906uLKCt+6DMjvnprvnV8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , Chris Mason , Jens Axboe , Keith Busch , Sasha Levin Subject: [PATCH 6.1 0107/1059] nvmet-rdma: take a device off the list last Date: Fri, 4 Dec 2026 18:53:58 +0900 Message-ID: <20261204100646.971115074@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chris Mason [ Upstream commit 86ae3841aea4e29d7ac08d5614ca3823dc8dfbc9 ] nvmet_rdma_remove_one() disconnects the queues of a device and flushes nvmet-wq, but since commit a3dd7d0022c3 it returns right away if the device isn't on device_list. nvmet_rdma_free_dev(), run by the release work of the last queue, takes the device off that list first and frees the SRQs and the PD afterwards. A device removal in between finds nothing on the list, returns, and the RDMA core frees the device under ib_dealloc_pd(). Free the SRQs and the PD first and unlist the device last, so the remove callback finds it and its flush waits for the release work. Fixes: a3dd7d0022c3 ("nvmet-rdma: Don't flush system_wq by default during remove_one") Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Signed-off-by: Chris Mason Signed-off-by: Jens Axboe Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/target/rdma.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/target/rdma.c b/drivers/nvme/target/rdma.c index 7e595b8dcdc75..53214a092c62f 100644 --- a/drivers/nvme/target/rdma.c +++ b/drivers/nvme/target/rdma.c @@ -1200,13 +1200,18 @@ static void nvmet_rdma_free_dev(struct kref *ref) struct nvmet_rdma_device *ndev = container_of(ref, struct nvmet_rdma_device, ref); + nvmet_rdma_destroy_srqs(ndev); + ib_dealloc_pd(ndev->pd); + + /* + * Only delete from the device list once all RDMA resources are torn + * down because nvmet_rdma_remove_one waits for the release work only + * if the device still is on the list. + */ mutex_lock(&device_list_mutex); list_del(&ndev->entry); mutex_unlock(&device_list_mutex); - nvmet_rdma_destroy_srqs(ndev); - ib_dealloc_pd(ndev->pd); - kfree(ndev); } -- 2.53.0