The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2b4dbad2db5766294ee97bb96228ec6826a9e7c3

commit 2b4dbad2db5766294ee97bb96228ec6826a9e7c3
Author:     Chuck Silvers <[email protected]>
AuthorDate: 2025-11-25 22:30:19 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2025-11-25 22:46:52 +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.
    
    Reviewed by:    imp
    Fixes:          dffd882d12d2a71aca464f48209ec9ae6f393b15
    Sponsored by:   Netflix
    MFC After:      1 minute
---
 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 506fce3d99d3..833738cfcb98 100644
--- a/sys/cam/nvme/nvme_da.c
+++ b/sys/cam/nvme/nvme_da.c
@@ -648,7 +648,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;
@@ -667,10 +666,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
@@ -944,6 +939,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

Reply via email to