Skip to content

Commit 2106e1f

Browse files
Peter-JanGootzenmstsirkin
authored andcommitted
virtio-fs: let -ENOMEM bubble up or burst gently
Currently, when the enqueueing of a request or forget operation fails with -ENOMEM, the enqueueing is retried after a timeout. This patch removes this behavior and treats -ENOMEM in these scenarios like any other error. By bubbling up the error to user space in the case of a request, and by dropping the operation in case of a forget. This behavior matches that of the FUSE layer above, and also simplifies the error handling. The latter will come in handy for upcoming patches that optimize the retrying of operations in case of -ENOSPC. Signed-off-by: Peter-Jan Gootzen <[email protected]> Reviewed-by: Max Gurtovoy <[email protected]> Reviewed-by: Yoray Zack <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]>
1 parent e7909ad commit 2106e1f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/fuse/virtio_fs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ static void virtio_fs_request_dispatch_work(struct work_struct *work)
447447

448448
ret = virtio_fs_enqueue_req(fsvq, req, true);
449449
if (ret < 0) {
450-
if (ret == -ENOMEM || ret == -ENOSPC) {
450+
if (ret == -ENOSPC) {
451451
spin_lock(&fsvq->lock);
452452
list_add_tail(&req->list, &fsvq->queued_reqs);
453453
schedule_delayed_work(&fsvq->dispatch_work,
@@ -494,7 +494,7 @@ static int send_forget_request(struct virtio_fs_vq *fsvq,
494494

495495
ret = virtqueue_add_outbuf(vq, &sg, 1, forget, GFP_ATOMIC);
496496
if (ret < 0) {
497-
if (ret == -ENOMEM || ret == -ENOSPC) {
497+
if (ret == -ENOSPC) {
498498
pr_debug("virtio-fs: Could not queue FORGET: err=%d. Will try later\n",
499499
ret);
500500
list_add_tail(&forget->list, &fsvq->queued_reqs);
@@ -1367,7 +1367,7 @@ __releases(fiq->lock)
13671367
fsvq = &fs->vqs[queue_id];
13681368
ret = virtio_fs_enqueue_req(fsvq, req, false);
13691369
if (ret < 0) {
1370-
if (ret == -ENOMEM || ret == -ENOSPC) {
1370+
if (ret == -ENOSPC) {
13711371
/*
13721372
* Virtqueue full. Retry submission from worker
13731373
* context as we might be holding fc->bg_lock.

0 commit comments

Comments
 (0)