public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH 1/3] virtiofs: Only parse the out header if the request expects a reply in virtio_fs_request_complete()
@ 2026-03-23  9:43 Li Wang
  2026-03-23  9:43 ` [PATCH 2/3] virtiofs: Allow ENOMEM requests to wait and retry later in send_forget_request() Li Wang
  2026-03-23  9:43 ` [PATCH 3/3] virtiofs: Distinguish between 1 and negative return values " Li Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Li Wang @ 2026-03-23  9:43 UTC (permalink / raw)
  To: Stefan Hajnoczi, German Maglione, Vivek Goyal, Miklos Szeredi
  Cc: Eugenio Pérez, virtualization, linux-fsdevel, Li Wang

The value of req->out.h may be undefined when FR_ISREPLY is not set.

Signed-off-by: Li Wang <liwang@kylinos.cn>
---
 fs/fuse/virtio_fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 2f7485ffac52..dec2c5a30e4e 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -789,7 +789,8 @@ static void virtio_fs_request_complete(struct fuse_req *req,
 	struct folio *folio;
 
 	args = req->args;
-	copy_args_from_argbuf(args, req);
+	if (test_bit(FR_ISREPLY, &req->flags))
+		copy_args_from_argbuf(args, req);
 
 	if (args->out_pages && args->page_zeroing) {
 		len = args->out_args[args->out_numargs - 1].size;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] virtiofs: Allow ENOMEM requests to wait and retry later in send_forget_request()
  2026-03-23  9:43 [PATCH 1/3] virtiofs: Only parse the out header if the request expects a reply in virtio_fs_request_complete() Li Wang
@ 2026-03-23  9:43 ` Li Wang
  2026-03-23  9:43 ` [PATCH 3/3] virtiofs: Distinguish between 1 and negative return values " Li Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Li Wang @ 2026-03-23  9:43 UTC (permalink / raw)
  To: Stefan Hajnoczi, German Maglione, Vivek Goyal, Miklos Szeredi
  Cc: Eugenio Pérez, virtualization, linux-fsdevel, Li Wang

Allow ENOMEM requests to wait and retry later,
rather than dropping them.

Signed-off-by: Li Wang <liwang@kylinos.cn>
---
 fs/fuse/virtio_fs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index dec2c5a30e4e..bf043e698e0d 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -611,7 +611,7 @@ static void virtio_fs_request_dispatch_work(struct work_struct *work)
 }
 
 /*
- * Returns 1 if queue is full and sender should wait a bit before sending
+ * Returns 1 if queue or memory is full and sender should wait a bit before sending
  * next request, 0 otherwise.
  */
 static int send_forget_request(struct virtio_fs_vq *fsvq,
@@ -638,13 +638,13 @@ static int send_forget_request(struct virtio_fs_vq *fsvq,
 
 	ret = virtqueue_add_outbuf(vq, &sg, 1, forget, GFP_ATOMIC);
 	if (ret < 0) {
-		if (ret == -ENOSPC) {
+		if (ret == -ENOSPC || ret == -ENOMEM) {
 			pr_debug("virtio-fs: Could not queue FORGET: err=%d. Will try later\n",
 				 ret);
 			list_add_tail(&forget->list, &fsvq->queued_reqs);
 			if (!in_flight)
 				inc_in_flight_req(fsvq);
-			/* Queue is full */
+			/* Queue or memory is full */
 			ret = 1;
 		} else {
 			pr_debug("virtio-fs: Could not queue FORGET: err=%d. Dropping it.\n",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] virtiofs: Distinguish between 1 and negative return values in send_forget_request()
  2026-03-23  9:43 [PATCH 1/3] virtiofs: Only parse the out header if the request expects a reply in virtio_fs_request_complete() Li Wang
  2026-03-23  9:43 ` [PATCH 2/3] virtiofs: Allow ENOMEM requests to wait and retry later in send_forget_request() Li Wang
@ 2026-03-23  9:43 ` Li Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Li Wang @ 2026-03-23  9:43 UTC (permalink / raw)
  To: Stefan Hajnoczi, German Maglione, Vivek Goyal, Miklos Szeredi
  Cc: Eugenio Pérez, virtualization, linux-fsdevel, Li Wang

If virtqueue_add_outbuf() returns negative error codes other than
-ENOSPC and -ENOMEM, allow subsequent requests to proceed,
aligning with the comments in send_forget_request().

Signed-off-by: Li Wang <liwang@kylinos.cn>
---
 fs/fuse/virtio_fs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index bf043e698e0d..7b283db76f3f 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -652,6 +652,7 @@ static int send_forget_request(struct virtio_fs_vq *fsvq,
 			kfree(forget);
 			if (in_flight)
 				dec_in_flight_req(fsvq);
+			ret = 0;
 		}
 		goto out;
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-23  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23  9:43 [PATCH 1/3] virtiofs: Only parse the out header if the request expects a reply in virtio_fs_request_complete() Li Wang
2026-03-23  9:43 ` [PATCH 2/3] virtiofs: Allow ENOMEM requests to wait and retry later in send_forget_request() Li Wang
2026-03-23  9:43 ` [PATCH 3/3] virtiofs: Distinguish between 1 and negative return values " Li Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox