The branch stable/14 has been updated by arrowd: URL: https://cgit.FreeBSD.org/src/commit/?id=f3478cfc7817afcd47e8c9caee143fb807220ffc
commit f3478cfc7817afcd47e8c9caee143fb807220ffc Author: Mark Johnston <ma...@freebsd.org> AuthorDate: 2024-10-25 17:51:16 +0000 Commit: Gleb Popov <arr...@freebsd.org> CommitDate: 2025-07-04 13:28:06 +0000 virtio_p9fs: Fix handling of a full request queue If, when submitting a request, the virtqueue is full, we sleep until an interrupt has fired, then restart the request. However, while sleeping the channel lock is dropped, and in the meantime another thread may have reset the per-channel SG list, so upon retrying we'd (re)submit whatever happened to be left over in the previous request. Fix the problem by rebuilding the SG list after sleeping. Sponsored by: Klara, Inc. (cherry picked from commit fff518117b40cbc3bca49073eed85dc725ebae4c) --- sys/dev/virtio/p9fs/virtio_p9fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/virtio/p9fs/virtio_p9fs.c b/sys/dev/virtio/p9fs/virtio_p9fs.c index 43d5c0d9d6ba..d359fbbf1a3d 100644 --- a/sys/dev/virtio/p9fs/virtio_p9fs.c +++ b/sys/dev/virtio/p9fs/virtio_p9fs.c @@ -152,6 +152,7 @@ vt9p_request(void *handle, struct p9_req_t *req) /* Grab the channel lock*/ VT9P_LOCK(chan); +req_retry: sglist_reset(sg); /* Handle out VirtIO ring buffers */ error = sglist_append(sg, req->tc->sdata, req->tc->size); @@ -170,9 +171,7 @@ vt9p_request(void *handle, struct p9_req_t *req) } writable = sg->sg_nseg - readable; -req_retry: error = virtqueue_enqueue(vq, req, sg, readable, writable); - if (error != 0) { if (error == ENOSPC) { /*