Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Jul 2025 04:00:56 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: b4b166b8c46b - main - cam: Enforce real priorities in xpt_action for queued ccbs.
Message-ID:  <202507220400.56M40udG032587@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

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

commit b4b166b8c46b86df855f1621d2aa4b6ab26b3a5e
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2025-07-22 03:52:22 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-07-22 04:00:53 +0000

    cam: Enforce real priorities in xpt_action for queued ccbs.
    
    All queued CCBs should be created with a real priority (one that's not
    CAM_PRIORITY_NONE). Recently, I introduced a bug that revealed a latent
    MMC bug where it would stop enumerating due to a bad priority. Add an
    assert to catch that (the other bug in mmc_da that it found has been
    fixed).
    
    Sponsored by:           Netflix
---
 sys/cam/cam_xpt.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 2ec736e7f4ac..cae29226d13c 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -2515,6 +2515,15 @@ xpt_action(union ccb *start_ccb)
 	    ("xpt_action: func %#x %s\n", start_ccb->ccb_h.func_code,
 		xpt_action_name(start_ccb->ccb_h.func_code)));
 
+	/*
+	 * Either it isn't queued, or it has a real priority. There still too
+	 * many places that reuse CCBs with a real priority to do immediate
+	 * queries to do the other side of this assert.
+	 */
+	KASSERT((start_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0 ||
+	    start_ccb->ccb_h.pinfo.priority != CAM_PRIORITY_NONE,
+	    ("%s: queued ccb and CAM_PRIORITY_NONE illegal.", __func__));
+
 	start_ccb->ccb_h.status = CAM_REQ_INPROG;
 	(*(start_ccb->ccb_h.path->bus->xport->ops->action))(start_ccb);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202507220400.56M40udG032587>