Fwd: git: b4b166b8c46b - main - cam: Enforce real priorities in xpt_action for queued ccbs.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Jul 2025 04:04:52 UTC
Heads up: I added some enforcement of the rules to CAM. I'd been
bitten by this condition with some cleanup I did that caused mmccam to
no longer probe devices. I've tested it locally on a couple of
machines that have a couple of different SIMs/HBAs, for scsi, ata,
nvme and mmc. I fixed what I could find, but if you hit this assert,
please let me know.
Warner
---------- Forwarded message ---------
From: Warner Losh <imp@freebsd.org>
Date: Mon, Jul 21, 2025 at 10:01 PM
Subject: git: b4b166b8c46b - main - cam: Enforce real priorities in
xpt_action for queued ccbs.
To: <src-committers@freebsd.org>, <dev-commits-src-all@freebsd.org>,
<dev-commits-src-main@freebsd.org>
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);
}