The commit is pushed to "branch-rh9-5.14.0-427.77.1.vz9.86.x-ovz" and will appear at g...@bitbucket.org:openvz/vzkernel.git after rh9-5.14.0-427.77.1.vz9.86.6 ------> commit c33acb59caf071c5dc0ce5e2c201c2fca4102902 Author: Liu Kui <kui....@virtuozzo.com> Date: Mon Sep 15 21:01:59 2025 +0800
fs/fuse: revamp the struct fuse_args; Apparently the 'inode' is redundant given the presence of 'io_inode', so removes it. meanwhile move the 'page_cache' and 'killed' bit after other bit field. Signed-off-by: Liu Kui <kui....@virtuozzo.com> ====== Patchset description: fs/fuse: Revamp fuse_invalidate_files() Current implementation requires traversing various queues to find requests that need to be killed. This approach is problematic because: 1. Requests can move between different queues during their lifecycle 2. Special care must be taken when moving requests between queues to avoid missing requests that need to be killed. 3. The current implementation is complex, bug-prone, and difficult to maintain This patch series implements a cleaner solution by introducing a dedicated queue to track all killable requests. Each request is enqueued when created and dequeued only when destroyed, ensuring that no requests are missed during kill operations. Key changes: - Add a new killable requests queue to track all requests that can be killed - Simplify kill operations by iterating only through the dedicated queue - Remove complex queue traversal logic and race condition handling - Improve code maintainability and reduce bug potential Implements #VSTOR-101450 https://virtuozzo.atlassian.net/browse/VSTOR-101450 Feature: vStorage --- fs/fuse/dev.c | 4 ++-- fs/fuse/file.c | 3 +-- fs/fuse/fuse_i.h | 12 +++--------- fs/fuse/inode.c | 2 +- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index b437b8de19bbf..e3e97ed8c92f6 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -1421,8 +1421,8 @@ static ssize_t fuse_dev_do_read(struct fuse_dev *fud, struct file *file, goto out_end; } - if (args->page_cache && args->inode) { - struct fuse_inode *fi = get_fuse_inode(args->inode); + if (args->page_cache && args->io_inode) { + struct fuse_inode *fi = get_fuse_inode(args->io_inode); if (test_bit(FUSE_I_INVAL_FILES, &fi->state) || args->killed) { req->out.h.error = -EIO; diff --git a/fs/fuse/file.c b/fs/fuse/file.c index cfc5da819438b..074e6ee11eb91 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -850,7 +850,6 @@ void fuse_read_args_fill(struct fuse_io_args *ia, struct file *file, loff_t pos, if (opcode == FUSE_READ && count >= read_route_break) { args->fiq = fuse_route_io(ff->fm->fc, &ff->fm->fc->rrt, count, args->io_inode); - args->inode = file->f_path.dentry->d_inode; args->ff = ff; } } @@ -1211,7 +1210,7 @@ static void fuse_readpages_end(struct fuse_mount *fm, struct fuse_args *args, struct fuse_args_pages *ap = &ia->ap; size_t count = ia->read.in.size; size_t num_read = args->out_args[0].size; - struct inode *inode = args->inode; + struct inode *inode = args->io_inode; if (unlikely(killed)) err = -EIO; diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 28c495cb2a469..02c80cb9873a1 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -316,21 +316,15 @@ struct fuse_args { bool nonblocking:1; bool kio_internal:1; bool async:1; + bool page_cache:1; + bool killed:1; struct fuse_in_arg in_args[3]; struct fuse_arg out_args[3]; void (*end)(struct fuse_mount *fm, struct fuse_args *args, int error); struct fuse_req *req; - /** Request contains pages from page-cache */ - unsigned page_cache:1; - - /** Request was killed -- pages were unlocked */ - unsigned killed:1; - - struct inode *io_inode; - /** Inode used in the request or NULL */ - struct inode *inode; + struct inode *io_inode; /** Request will be handled by fud pointing to this fiq */ struct fuse_iqueue *fiq; diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 82baa1d0b800c..4d140c2d0f5c3 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -484,7 +484,7 @@ void fuse_kill_requests(struct fuse_conn *fc, struct inode *inode, struct fuse_req *req; list_for_each_entry(req, req_list, list) - if (req->args->inode == inode && req->args->page_cache && + if (req->args->io_inode == inode && req->args->page_cache && !req->args->killed) { struct fuse_io_args *ia = container_of(req->args, typeof(*ia), ap.args); _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel