From nobody Tue Nov 18 21:04:55 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 4d9xvW666Lz6GYKw for ; Tue, 18 Nov 2025 21:04:55 +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 4d9xvW29bwz3lZj for ; Tue, 18 Nov 2025 21:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763499895; 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=HMK8jkE5bbcgRhyVkefZjSLo6iLGMy56/HipYRBvbWo=; b=wJcgUJvu5jiWpI8hWF+MqRvx9MWwj03noFIgS5yU2aLFLwBk3QKktBW7+LKtrIp0MgOfFX oYv7UXUFc+hnzaX78AV83k0U4ySibrb3X1rK5IO6mxQeq1a5V8g5iqZUga8ZyxXlfUBSZK yGrVj0aUdbnQx7c7BI1Igsm2TZ6MXPePVe/SFDebvNAdQ0xpZszt0HC3lhD9TzjNaGBEwq N4bRHZZmLnjbs2Y2NpRRxnrBqSHNyX8vYJQERzc70pEglhap1Id6FB3Nor3gx4KIfEaxmE FjI/NpOLcmZFR0LLjbyeRl08ZUQO9qzxTPsYk9ZfpIN5yq8pPSW3urYbs/04SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763499895; 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=HMK8jkE5bbcgRhyVkefZjSLo6iLGMy56/HipYRBvbWo=; b=urxVCk09VRwIIiwS6PnPztJQadUEmnJyE7AnBQ1+XFfBr3pIKDCT3fHFTYaIocgs+pMf47 EKJAil2FSe/Wx2f+IXBO6hOVeBTFMacrHclD8l02KYFXYt+3pHaa0KQk8mQ0yy0G+N0rsW n3NTMeOJgJ6OGNl9Lkc2xIvcIcwgJ3MELfcoyWHQ2kQTzCeruV+LVGjG0x7+FMp3MKLr/Q K9y/eLaFZvpYqI7DPGrNLWBd16PdxVrCjsGFSjfT3ennUrcx3OfZDs4mJhPQ5+/tVQwRJE md8dpPanJAKN55yNY3yjGKAutyhPHWm1tAifx6AhaOKLLZnbgYtWNPLjDlNdPg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763499895; a=rsa-sha256; cv=none; b=YwwtfxXHCF5Dr3n74wYDLzpeG4uZYxqsD9AfJTC/mrqABuhyZH9GvecFJbmW+2OqxZj49m Nn/9Okx5ShretUGdhZgVbnNB0Gw3HG+S6jLLDpAOBUtj352T5C1VfC91Q1Wbk/ykg3+l12 7lpSBRwPLYjyAjiHFFKvwkDRG0zrj7aH6W0UqLm+7Uyi+9R6Cn2WzoRIDz/Bc0wGZT06fX p/u/CHxfp5je5BEsb+ktVfDyS24A/3r3hLaJS1lfe5GJhWW32ZUiq0z349uepCn1TKCx2S KCmO5aDrECXtCYhqup3EVJZcq+GXVzEtAPvn5HF4HzoC1a8G6zNNFFPcGcqlhg== 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 4d9xvW158tz19W8 for ; Tue, 18 Nov 2025 21:04:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 33fc1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 18 Nov 2025 21:04:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Wanpeng Qian From: Warner Losh Subject: git: 4640f5008922 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 4640f5008922c5b189d2f7b63edf73300277e6df Auto-Submitted: auto-generated Date: Tue, 18 Nov 2025 21:04:55 +0000 Message-Id: <691cdf77.33fc1.65f3627e@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=4640f5008922c5b189d2f7b63edf73300277e6df commit 4640f5008922c5b189d2f7b63edf73300277e6df Author: Wanpeng Qian AuthorDate: 2025-11-18 17:24:13 +0000 Commit: Warner Losh CommitDate: 2025-11-18 21:01:43 +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 --- 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 7693aa6d54d3..e015fbe4d072 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);