For hiprio queue (forget requests), we are keeping a state in queue whether
queue is connected or not. If queue is not connected, do not try to submit
request and return error instead.

As of now, we are checking for this state only in path where worker tries
to submit forget after first attempt failed. Check this state even in
the path when request is being submitted first time.

Signed-off-by: Vivek Goyal <vgo...@redhat.com>
---
 fs/fuse/virtio_fs.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index a708ccb65662..e9497b565dd8 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -577,9 +577,16 @@ __releases(fiq->waitq.lock)
        sg_init_one(&sg, forget, sizeof(*forget));
 
        /* Enqueue the request */
+       spin_lock(&fsvq->lock);
+
+       if (!fsvq->connected) {
+               kfree(forget);
+               spin_unlock(&fsvq->lock);
+               goto out;
+       }
+
        vq = fsvq->vq;
        dev_dbg(&vq->vdev->dev, "%s\n", __func__);
-       spin_lock(&fsvq->lock);
 
        ret = virtqueue_add_sgs(vq, sgs, 1, 0, forget, GFP_ATOMIC);
        if (ret < 0) {
-- 
2.20.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Reply via email to