From nobody Tue Mar 3 18:01:15 2026 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 4fQNs76MXbz6TR1s for ; Tue, 03 Mar 2026 18:01:15 +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" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fQNs73hWtz3JMN for ; Tue, 03 Mar 2026 18:01:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772560875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TwG31/mJXuxBmLMpCV3l/uQ1c+P+lJ0rJmGh/jRRQwc=; b=VcpxY2sKxtr0oN9m63vJlFnDWlWsE5fJP47QxnbFEc1/nWw/drUNfjg7i379rGF2HhNG5o 66dgsDfXTO/P4XBKd1Mx/0vcZ4UnFfvq1rqt9cjeHThth7aHN6TStrqJsaWkCrM70+KG+3 J7EQFxAAhBT9/6z6nZ1EK0gMq++qqMB0pK5OLub3KUhVF3A3dSdrIkEVOSzgNOb9/JtVr1 jVcvm0PttO2piUp/h25kq3V6bCfCKqjyNcxNmeVLe7kzNYs1RWMpw+6LIvtu1FGVRfLGkk PJWBpvuEd6GNf/h6wsufG/k0IAM9k+l9GAOd836Le7aHmQzHiMsdifzaB69EPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772560875; a=rsa-sha256; cv=none; b=UJVSOmDjJOUsAdOfPNREjV/uvNBvjatHeGZD/TLB8v3Ia7DwtFRpUicd8t7T0Fr+vaQkOa mgiKEnSzd7x6gBx8ZOUgYr06go9EGNVpFo+9zkMal49jBfd1hPWqKjiHTNBRZ1agPzKceQ boNqeJVGn1ilrzX2zwbMGzOjfdx9kh9yU9c/8O8cpCgNAmhzhVb+geC84TFZOTOcwBXEdi l+7m/ReSmRXK8/RgQI0NDfb+LPp7gG4fph7PJBMiIQYVqYEiLdGZi1sxKyAboE4ZnVXSG2 PtfvRiX8iSE3fOnWjEQeSRWA/2GS6f7aeHZoXumtKUQ4diQjjgsbAb7t7w0Y8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772560875; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TwG31/mJXuxBmLMpCV3l/uQ1c+P+lJ0rJmGh/jRRQwc=; b=AWGWpBGCzQn1n5VDFDIyjAMQAQiuLop2t8obW2HSEqVhNnzT/MTgAe3P9fkV6u5sjZHVTX 52FKCWdifImshJ6wVxYqZpM+a81i51mAdByChSA1lI91cih+PGdNeH8ZwLa/d0Ehlo57f3 E+5nJkEjd90WUxo4CD+rTzp1UYwbHHOImg0g6WF9CmRHcKnmnsW2xQ5iajCfX7qK4biC+P pZRwnlEFKanwzSo16/CdjaF0WQPtnJvg2b/nlpp+xnsk4WJ/sPQnMIs0AIE2+WznIbK891 qDGVm5npHn25DW4ePdahyWwbVR7IeqxJtdBUqmtU29lgJ8QUBMjqFBWvaQbMag== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fQNs7324tzjc for ; Tue, 03 Mar 2026 18:01:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 42f2e by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 03 Mar 2026 18:01:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 628d7a3270b6 - main - nda: AC_GETDEV_CHANGED calls media chanaged for sectorsize change 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: 628d7a3270b64b6c7fae3b0c98068c670162a154 Auto-Submitted: auto-generated Date: Tue, 03 Mar 2026 18:01:15 +0000 Message-Id: <69a721eb.42f2e.29157302@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=628d7a3270b64b6c7fae3b0c98068c670162a154 commit 628d7a3270b64b6c7fae3b0c98068c670162a154 Author: Warner Losh AuthorDate: 2026-03-03 17:59:36 +0000 Commit: Warner Losh CommitDate: 2026-03-03 17:59:36 +0000 nda: AC_GETDEV_CHANGED calls media chanaged for sectorsize change When the sector size changes, we assume it's new media. When the mediasize changes, we'll just resize the disk (we get called for both events). When neither have changed, don't call either. Some NVMe drives (but not all) post a async event on page 4 with the sector size changes via a FORMAT command. We'll notice the new media right away, rather than the next device open. As a practical effect, this just means that certain geom operations will see it sooner. Since most drive interaction goes through open, that will catch those drives that do not post this event well enough. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D55521 --- sys/cam/nvme/nvme_da.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c index 2e8e376f985d..a1114ffe8a44 100644 --- a/sys/cam/nvme/nvme_da.c +++ b/sys/cam/nvme/nvme_da.c @@ -432,7 +432,7 @@ ndaclose(struct disk *dp) ("nda %d outstanding commands", softc->outstanding_cmds)); cam_periph_unlock(periph); cam_periph_release(periph); - return (0); + return (0); } static void @@ -760,17 +760,23 @@ ndaasync(void *callback_arg, uint32_t code, struct cam_path *path, void *arg) } case AC_GETDEV_CHANGED: { - int error; + off_t mediasize; + u_int sectorsize; softc = periph->softc; + mediasize = softc->disk->d_mediasize; + sectorsize = softc->disk->d_sectorsize; 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; - } + /* + * If the sectorsize changed, then it's new media. Otherwise if + * the media size changed, resize the existing disk. Otherwise + * do nothing. + */ + if (sectorsize != softc->disk->d_sectorsize) + disk_media_changed(softc->disk, M_WAITOK); + else if (mediasize != softc->disk->d_mediasize) + disk_resize(softc->disk, M_WAITOK); break; - } case AC_ADVINFO_CHANGED: {