From nobody Wed Nov 19 04:13:24 2025 X-Original-To: dev-commits-src-branches@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 4dB7Pw6M94z6HCg4 for ; Wed, 19 Nov 2025 04:13:24 +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 4dB7Pw3J65z3gvJ for ; Wed, 19 Nov 2025 04:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763525604; 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=zWdoNFkzfMuFD9TbV+K7cVjddaJF6nqb4sBd9r40c1w=; b=PcfLUhyDgkd0YSAvJ6smI+BZzgwoOG7siZEOPHGFvrtdAzWuP/blSZPrb5QlTtSqrdhA5a UDx7ovMTL+6LTz6Y6NeA2MYkjybUdBvHjHpHvBvxJBkr+9tBa0KgxYpxU5oz6fp72bsrnw UBHSA4nq7Zq4xpqZvP3QmYDWJygy0muRh2l3uVgxwVedWkmQw8e2OViNuv5d+HZYaRqg0F XWG/TYpNw0F64ydn5XDvfd6cDKluEqQecjlLwRUkq/Bk67yyUlcvo9C7E0RKS14IhmeDsY 8Uxmgow8X0Lzud/BEv1nkLu9Y5ruSmMM9scig2P/eF59rCAzfukTcYLSZ8cqww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763525604; 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=zWdoNFkzfMuFD9TbV+K7cVjddaJF6nqb4sBd9r40c1w=; b=hIhv6PvcD2wpsEcmREpD4EAgfl3X9PFHgkg6fT1u9iR/ikHUVgd8wHoZ/BU67OVjz0D/Wj ZH+Ubpd9W8WsychAHaJPf/WTzNNMw/CFaBVQpCdrMR5URvxQkDEQFKs4+vlNPg5qGb/eBY 13vIxtl4nEr2Z/nugzdHFG2pL5DngXerxbhHasxtJKmIob3k3XunnrK/1sDDUjfCsL69dD FJcE59UbbkjCMX4p3GLr428DwrRKdskrdOf81OHjGZKmcPF+XFuJqepjxqhVzKqY1UlFqN I1iHZ01I6AvT3RyIlUHk6sB/V0xCGycqPpYniz+l5p1cRqonB140bFf2hloEsQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763525604; a=rsa-sha256; cv=none; b=ucTI8NsNhX7p98c3SCx/3GHyYVzVGoJXsBtmGfTKIw2Dupl8oAOm/ys4cMcSQ7VKW64S2I wxszNOqAJep5zfkiuGnQbCS+pndrdIaUP/cEkdUKNps/QHBuPWKNymgvLEvRFlLXkPdX/O s9EK21BKhGUOdCyfAU5RzGntpnJaqX6c1VTmk6b7MC3aF1j48vYL9P/3vC8mhvTers2Qss pohZgyJlNZMqkewH4JDoQHqxRhxBaoliLUotDmCHhe6uqI+5SpMxIoNaRDAtdC3MZ0U2Ne R6ZzFzBF/kIg2I5fdnitlJTSF/QoUbQ0UAN8gPTKw+XgK05lAIX6Ten0epinjw== 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 4dB7Pw2LtNz7x4 for ; Wed, 19 Nov 2025 04:13:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 91a6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 19 Nov 2025 04:13:24 +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: 9a465b37ea17 - stable/15 - nda: React to namespace change events List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: 9a465b37ea17642d45597d4ee7d3283b02dfa6f0 Auto-Submitted: auto-generated Date: Wed, 19 Nov 2025 04:13:24 +0000 Message-Id: <691d43e4.91a6.765ccaff@gitrepo.freebsd.org> The branch stable/15 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9a465b37ea17642d45597d4ee7d3283b02dfa6f0 commit 9a465b37ea17642d45597d4ee7d3283b02dfa6f0 Author: Wanpeng Qian AuthorDate: 2025-11-18 15:24:23 +0000 Commit: Warner Losh CommitDate: 2025-11-19 04:10:53 +0000 nda: React to namespace change events Register for AC_GETDEV_CHANGED. When we receive a namespace notification, we only create a new device if it was unconfigured. If it was configured, generate this async event. Rely on the fact that we reconstruct namespace to just get the data from the identify data and call disk_resised. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D33032 (cherry picked from commit 86d3ec359a56d1b5d015718bd19ef4bda681a032) --- sys/cam/nvme/nvme_da.c | 29 ++++++++++++++++++++--------- sys/cam/nvme/nvme_xpt.c | 2 ++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c index 330f4ca66e1e..2eb43809f4b1 100644 --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -673,12 +673,11 @@ ndasetgeom(struct nda_softc *softc, struct cam_periph *periph) } static void -ndaasync(void *callback_arg, uint32_t code, - struct cam_path *path, void *arg) +ndaasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) { - struct cam_periph *periph; + struct cam_periph *periph = callback_arg; + struct nda_softc *softc; - periph = (struct cam_periph *)callback_arg; switch (code) { case AC_FOUND_DEVICE: { @@ -709,17 +708,29 @@ ndaasync(void *callback_arg, uint32_t code, "due to status 0x%x\n", status); break; } + case AC_GETDEV_CHANGED: + { + int error; + + softc = periph->softc; + ndasetgeom(softc, periph); + error = disk_resize(softc->disk, M_NOWAIT); + if (error != 0) { + xpt_print(periph->path, "disk_resize(9) failed, error = %d\n", error); + break; + } + break; + + } case AC_ADVINFO_CHANGED: { uintptr_t buftype; + softc = periph->softc; buftype = (uintptr_t)arg; if (buftype == CDAI_TYPE_PHYS_PATH) { - struct nda_softc *softc; - - softc = periph->softc; disk_attr_changed(softc->disk, "GEOM::physpath", - M_NOWAIT); + M_NOWAIT); } break; } @@ -997,7 +1008,7 @@ ndaregister(struct cam_periph *periph, void *arg) * Register for device going away and info about the drive * changing (though with NVMe, it can't) */ - xpt_register_async(AC_LOST_DEVICE | AC_ADVINFO_CHANGED, + xpt_register_async(AC_LOST_DEVICE | AC_ADVINFO_CHANGED | AC_GETDEV_CHANGED, ndaasync, periph, periph->path); softc->state = NDA_STATE_NORMAL; diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c index f6667df07be0..c22d5fed350c 100644 --- a/sys/cam/nvme/nvme_xpt.c +++ b/sys/cam/nvme/nvme_xpt.c @@ -463,6 +463,8 @@ device_fail: if ((path->device->flags & CAM_DEV_UNCONFIGURED) == 0) done_ccb->ccb_h.func_code = XPT_GDEV_TYPE; xpt_action(done_ccb); xpt_async(AC_FOUND_DEVICE, path, done_ccb); + } else { + xpt_async(AC_GETDEV_CHANGED, path, NULL); } NVME_PROBE_SET_ACTION(softc, NVME_PROBE_DONE); break;