Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2025 23:43:58 +0000
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        Chuck Silvers <chs@FreeBSD.org>
Subject:   git: 4f2d5bcdbf9b - releng/15.0 - nda: fix setting of unmappedio flag
Message-ID:  <69263f3e.3f258.6afefa46@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch releng/15.0 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f2d5bcdbf9bb9ecdee48d47c1c33a461f3f54e4

commit 4f2d5bcdbf9bb9ecdee48d47c1c33a461f3f54e4
Author:     Chuck Silvers <chs@FreeBSD.org>
AuthorDate: 2025-11-25 22:30:19 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-25 23:41:38 +0000

    nda: fix setting of unmappedio flag
    
    The upstream refactoring of ndaregister() to split out ndasetgeom()
    accidentally used an uninitialed variable to decide whether or not
    to set DISKFLAG_UNMAPPED_BIO.  Fix this by moving that portion of
    ndasetgeom() back up to ndaregister().  The check for PIM_UNMAPPED
    is not really needed because nvme devices always have that set,
    so it cannot change in the other path that ndasetgeom() is now called.
    
    Approved by:    re (cperciva)
    Reviewed by:    cperciva, gallatin, imp
    Fixes:          dffd882d12d2a71aca464f48209ec9ae6f393b15
    Sponsored by:   Netflix
    MFC After:      1 minute
    (cherry picked from commit 2b4dbad2db5766294ee97bb96228ec6826a9e7c3)
    (cherry picked from commit e271f9327f46250c9043c29c86e943d53080bf2a)
---
 sys/cam/nvme/nvme_da.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c
index 2eb43809f4b1..d409961cea65 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -647,7 +647,6 @@ static void
 ndasetgeom(struct nda_softc *softc, struct cam_periph *periph)
 {
 	struct disk *disk = softc->disk;
-	struct ccb_pathinq cpi;
 	const struct nvme_namespace_data *nsd;
 	const struct nvme_controller_data *cd;
 	uint8_t flbas_fmt, lbads, vwc_present;
@@ -666,10 +665,6 @@ ndasetgeom(struct nda_softc *softc, struct cam_periph *periph)
 	vwc_present = NVMEV(NVME_CTRLR_DATA_VWC_PRESENT, cd->vwc);
 	if (vwc_present)
 		disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
-	if ((cpi.hba_misc & PIM_UNMAPPED) != 0) {
-		disk->d_flags |= DISKFLAG_UNMAPPED_BIO;
-		softc->unmappedio = 1;
-	}
 }
 
 static void
@@ -943,6 +938,10 @@ ndaregister(struct cam_periph *periph, void *arg)
 		maxio = maxphys;	/* for safety */
 	disk->d_maxsize = maxio;
 	ndasetgeom(softc, periph);
+	if ((cpi.hba_misc & PIM_UNMAPPED) != 0) {
+		disk->d_flags |= DISKFLAG_UNMAPPED_BIO;
+		softc->unmappedio = 1;
+	}
 
 	/*
 	 * d_ident and d_descr are both far bigger than the length of either


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69263f3e.3f258.6afefa46>