From nobody Wed Nov 19 04:13:26 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dB7Py6YJFz6HCg8 for ; Wed, 19 Nov 2025 04:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dB7Py4YkPz3gdq for ; Wed, 19 Nov 2025 04:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763525606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i6x8gXW0s1f4uFDxpFwdEkLamxsrG7Mn47x1dnzfTH0=; b=Wy3afBwa5Q1TzSp1HhO4oqEZ+2OHTWAzXzzy6WSsrvS7rmNP/s9ZmEWr9+sk5UXOqNCRJ5 ae6mmjlHOs6NOOSrc2S77EvQH+6h9ZU9naDu94H6zx9lPek9FljVdfrOhi4VoB0jaCbvu0 mNY51gWnVigeKG3mTn3y2b5RLBYZ9Cwc6tBc/GsbCqAqFQq7McgI5I2QxCnUhEW3W7VBvY RtuMjIaGf6A4OLx3aZ7+bUGDGWaRWTBxDJsLocGqA0aIrzsOZ/G+lU4q0EYPVloWfAvEZz T9E+FDQf7M+KsN0YtKYVBYdrrYRK4MJvXmA/e82rZIf7Sxyx+XOdd8aYiOwLaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763525606; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i6x8gXW0s1f4uFDxpFwdEkLamxsrG7Mn47x1dnzfTH0=; b=Hf0+XggsreXBxux4fq+xcucuxJW07OmOHy2iF8DIVY0IbLn3ug/1l8rEjrY9hj2bvjNA9D xWF0H1shJsVj1a1YdTfvFwQhFy0XX6jNOrNenEFRsA0jIMGMd7z0Sq9b/vjvi908yFrJUN c3QvTAGKtBUJbIbIBc464bihb2yoPav96506XxbX1baHzLVSvvHsHIeViMbVXSXAP47y3T LwvAVDdjfCntZXt77x8S9h0F+lqo6e2y6vdIXGQGBoOgfIt9d+VUxE77zK5E8oYW2Q8f+3 CAdsy6GwWHbi20rE3Nu+DLkZA4aE+b0xOKLR9bSkMjTCzzocsJkKWBiHaBg8ZA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763525606; a=rsa-sha256; cv=none; b=hLXp7U9rrUJgDzqiKoLoRfKtBmO2vm6IXpUaZlm/ekMpU/9qZRWiE8j5Q3Pf6QF2P1Vzdq Drn8zOPBpCgH+3vPwaem7m9/bdbDYY1jQmsnnMAtx/YrO2z2eQj7ptx/bFOyOKh0+pH9UK d4N+1NAyRezJgmn0WC3tE22EKHdsroOc/LE0Ol+0aR7TYroOMtXK4wZurC/7HjOGDB5c27 iuCl8rvXbBghtQk0CB25G8xzQ3fRhmWat2JIJN1z8xLNYi44E/UMjWRoFFaS2fw+zaVrtx gUwdze6MvW2mz+C33fJ2tTJJ+m1HjcjPHXK8aftZkhaTzRlWQWG8YvypxPjLHQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dB7Py3mhJz8NZ for ; Wed, 19 Nov 2025 04:13:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 365d7 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 19 Nov 2025 04:13:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Wanpeng Qian From: Warner Losh Subject: git: b7ffac04541f - stable/15 - nvme_sim: signal namespace depature List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: b7ffac04541f98d3d8c6078092d59f0fed88b1ef Auto-Submitted: auto-generated Date: Wed, 19 Nov 2025 04:13:26 +0000 Message-Id: <691d43e6.365d7.2c0a2518@gitrepo.freebsd.org> The branch stable/15 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=b7ffac04541f98d3d8c6078092d59f0fed88b1ef commit b7ffac04541f98d3d8c6078092d59f0fed88b1ef Author: Wanpeng Qian AuthorDate: 2025-11-18 17:24:13 +0000 Commit: Warner Losh CommitDate: 2025-11-19 04:10:53 +0000 nvme_sim: signal namespace depature Signal when the namespace is gone so we can tear down the disk when a nvme drive is removed. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D33032 (cherry picked from commit 4640f5008922c5b189d2f7b63edf73300277e6df) --- sys/dev/nvme/nvme_sim.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index a06774a64761..f7fd0cee931b 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -352,25 +352,35 @@ static void * nvme_sim_ns_change(struct nvme_namespace *ns, void *sc_arg) { struct nvme_sim_softc *sc = sc_arg; + struct cam_path *tmppath; union ccb *ccb; + if (xpt_create_path(&tmppath, /*periph*/NULL, + cam_sim_path(sc->s_sim), 0, ns->id) != CAM_REQ_CMP) { + printf("unable to create path for rescan\n"); + return (NULL); + } + /* + * If it's gone, then signal that and leave. + */ + if (ns->flags & NVME_NS_GONE) { + xpt_async(AC_LOST_DEVICE, tmppath, NULL); + xpt_free_path(tmppath); + return (sc_arg); + } + ccb = xpt_alloc_ccb_nowait(); if (ccb == NULL) { printf("unable to alloc CCB for rescan\n"); return (NULL); } + ccb->ccb_h.path = tmppath; /* - * We map the NVMe namespace idea onto the CAM unit LUN. For - * each new namespace, we create a new CAM path for it. We then - * rescan the path to get it to enumerate. + * We map the NVMe namespace idea onto the CAM unit LUN. For each new + * namespace, scan or rescan the path to enumerate it. tmppath freed at + * end of scan. */ - if (xpt_create_path(&ccb->ccb_h.path, /*periph*/NULL, - cam_sim_path(sc->s_sim), 0, ns->id) != CAM_REQ_CMP) { - printf("unable to create path for rescan\n"); - xpt_free_ccb(ccb); - return (NULL); - } xpt_rescan(ccb); return (sc_arg);