]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
virtio_fs: fix the hash table using in virtio_fs_enqueue_req()
authorLi RongQing <lirongqing@baidu.com>
Thu, 3 Jul 2025 06:47:38 +0000 (14:47 +0800)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 27 Aug 2025 12:29:43 +0000 (14:29 +0200)
The original commit be2ff42c5d6e ("fuse: Use hash table to link
processing request") converted fuse_pqueue->processing to a hash table,
but virtio_fs_enqueue_req() was not updated to use it correctly.
So use fuse_pqueue->processing as a hash table, this make the code
more coherent

Co-developed-by: Fushuai Wang <wangfushuai@baidu.com>
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dev.c
fs/fuse/virtio_fs.c

index 3d8a3edebc23a4f8652eea9d25b3ed954436182e..f6259711ca1c671993483696232669e83ca3b5d2 100644 (file)
@@ -323,6 +323,7 @@ unsigned int fuse_req_hash(u64 unique)
 {
        return hash_long(unique & ~FUSE_INT_REQ_BIT, FUSE_PQ_HASH_BITS);
 }
+EXPORT_SYMBOL_GPL(fuse_req_hash);
 
 /*
  * A new request is available, wake fiq->waitq
index aeb488750fa6be39bbed63c12a85446e96562e66..c3a39061363e5b3f567e4d4850b9eb6b6fbc5d9a 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/cleanup.h>
 #include <linux/uio.h>
 #include "fuse_i.h"
+#include "fuse_dev_i.h"
 
 /* Used to help calculate the FUSE connection's max_pages limit for a request's
  * size. Parts of the struct fuse_req are sliced into scattergather lists in
@@ -1381,7 +1382,7 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
        unsigned int out_sgs = 0;
        unsigned int in_sgs = 0;
        unsigned int total_sgs;
-       unsigned int i;
+       unsigned int i, hash;
        int ret;
        bool notify;
        struct fuse_pqueue *fpq;
@@ -1441,8 +1442,9 @@ static int virtio_fs_enqueue_req(struct virtio_fs_vq *fsvq,
 
        /* Request successfully sent. */
        fpq = &fsvq->fud->pq;
+       hash = fuse_req_hash(req->in.h.unique);
        spin_lock(&fpq->lock);
-       list_add_tail(&req->list, fpq->processing);
+       list_add_tail(&req->list, &fpq->processing[hash]);
        spin_unlock(&fpq->lock);
        set_bit(FR_SENT, &req->flags);
        /* matches barrier in request_wait_answer() */