Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2024 18:19:58 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fff518117b40 - main - virtio_p9fs: Fix handling of a full request queue
Message-ID:  <202410251819.49PIJw9P087287@gitrepo.freebsd.org>

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

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

commit fff518117b40cbc3bca49073eed85dc725ebae4c
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-10-25 17:51:16 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-10-25 17:51:16 +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.
---
 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 cdcd9c125dbb..42f47a4f63cb 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) {
 			/*



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