git: 6442a92a7d9c - main - pass(4): Wake select/kqueue waiters when an immediate CCB completes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 11 Nov 2026 13:59:29 UTC
The branch main has been updated by ken:
URL: https://cgit.FreeBSD.org/src/commit/?id=6442a92a7d9c20c666999cc699610f1f5bec3cfd
commit 6442a92a7d9c20c666999cc699610f1f5bec3cfd
Author: Kenneth D. Merry <ken@FreeBSD.org>
AuthorDate: 2026-11-10 23:01:38 +0000
Commit: Kenneth D. Merry <ken@FreeBSD.org>
CommitDate: 2026-11-11 13:59:26 +0000
pass(4): Wake select/kqueue waiters when an immediate CCB completes
In the CAMIOQUEUE ioctl, a queued CCB completes through passdone(),
which moves it to the done queue and calls selwakeuppri() and
KNOTE_LOCKED() so that a consumer blocked in select(2), poll(2) or
kevent(2) wakes up and collects the CCB with CAMIOGET. An immediate
CCB (e.g. XPT_DEV_ADVINFO or XPT_DEV_MATCH) is instead executed
synchronously in the ioctl and moved to the done queue directly,
with no notification, so a consumer sleeping while waiting for its
completion never wakes up until some other queued I/O completes.
Send the same notification that passdone() sends. The peripheral
lock is held at this point and backs the knlist, so KNOTE_LOCKED()
is the correct variant.
A version of this fix has been in production use at Spectra Logic
since 2024.
Co-authored-by: Dave Baukus <daveb@spectralogic.com>
Reviewed by: imp
MFC after: 1 week
Sponsored by: Spectra Logic
Assisted-by: Claude Fable 5 <noreply@anthropic.com>
Differential Revision: https://reviews.freebsd.org/D61416
---
sys/cam/scsi/scsi_pass.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 6b1045dadf20..6bb91e453e2b 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -2074,11 +2074,14 @@ passdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread
/*
* If this is not a queued CCB (i.e. it is an immediate CCB),
* then it is already done. We need to put it on the done
- * queue for the user to fetch.
+ * queue for the user to fetch, and notify any waiters so
+ * they know there is a completed CCB to collect.
*/
if ((fc & XPT_FC_QUEUED) == 0) {
TAILQ_REMOVE(&softc->active_queue, io_req, links);
TAILQ_INSERT_TAIL(&softc->done_queue, io_req, links);
+ selwakeuppri(&softc->read_select, PRIBIO);
+ KNOTE_LOCKED(&softc->read_select.si_note, 0);
}
break;