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 53d7c3e9a7e991852d49be22b9ea308b1ede313d Author: Liu Kui <kui....@virtuozzo.com> Date: Mon Sep 15 21:02:01 2025 +0800
fs/fuse: remove fuse_kill_requests() Clean up code related to fuse_kill_requests() that's no longer used. Related to #VSTOR-101450 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/fuse_i.h | 3 -- fs/fuse/inode.c | 97 -------------------------------------- fs/fuse/kio/pcs/pcs_fuse_kdirect.c | 16 ------- 3 files changed, 116 deletions(-) diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index f77e8dfadaa30..901956ccb6d80 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -644,7 +644,6 @@ struct fuse_kio_ops { int (*file_open)(struct file *file, struct inode *inode); void (*file_close)(struct file *file, struct inode *inode); void (*inode_release)(struct fuse_inode *fi); - void (*kill_requests)(struct fuse_conn *fc, struct inode *inode); int (*ioctl)(struct file *file, struct inode *inode, unsigned int cmd, unsigned long arg, int len); int (*dev_ioctl)(struct fuse_conn *fc, unsigned int cmd, unsigned long arg, int len); }; @@ -1551,8 +1550,6 @@ struct fuse_file *__fuse_write_file_get(struct fuse_conn *fc, struct fuse_inode *fi); struct fuse_file *fuse_file_get(struct fuse_file *ff); void fuse_release_ff(struct inode *inode, struct fuse_file *ff); -void fuse_kill_requests(struct fuse_conn *fc, struct inode *inode, - struct list_head *req_list); struct fuse_req *fuse_dev_find_request(int fd, u64 unique); void fuse_revoke_readpages(struct fuse_file *ff); diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 0afc5d4cec8d3..3e0413048b118 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -478,62 +478,6 @@ void fuse_unlock_inode(struct inode *inode, bool locked) mutex_unlock(&get_fuse_inode(inode)->mutex); } -void fuse_kill_requests(struct fuse_conn *fc, struct inode *inode, - struct list_head *req_list) -{ - struct fuse_req *req; - - list_for_each_entry(req, req_list, list) - 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); - int i; - - BUG_ON(req->in.h.opcode != FUSE_READ); - - /* skip the request that is under data write back IO */ - if (test_bit(FR_LOCKED, &req->flags) && req->out.h.unique) - continue; - - req->args->killed = 1; - - for (i = 0; i < ia->ap.num_pages; i++) { - struct page *page = ia->ap.pages[i]; - SetPageError(page); - unlock_page(page); - } - } -} -EXPORT_SYMBOL_GPL(fuse_kill_requests); - -#if 0 -static void fuse_kill_routing(struct fuse_rtable *rt, struct fuse_conn *fc, struct inode *inode) -{ - if (rt->type == FUSE_ROUTING_CPU) { - int cpu; - - for_each_online_cpu(cpu) { - struct fuse_iqueue *fiq = per_cpu_ptr(rt->iqs_cpu, cpu); - - spin_lock(&fiq->lock); - fuse_kill_requests(fc, inode, &fiq->pending); - spin_unlock(&fiq->lock); - } - } else if (rt->type == FUSE_ROUTING_SIZE || rt->type == FUSE_ROUTING_HASH) { - int i; - - for (i = 0; i < rt->rt_size; i++) { - struct fuse_iqueue *fiq = rt->iqs_table + i; - - spin_lock(&fiq->lock); - fuse_kill_requests(fc, inode, &fiq->pending); - spin_unlock(&fiq->lock); - } - } -} -#endif - int fuse_invalidate_files(struct fuse_conn *fc, u64 nodeid) { struct inode *inode; @@ -571,53 +515,12 @@ int fuse_invalidate_files(struct fuse_conn *fc, u64 nodeid) err = filemap_write_and_wait(inode->i_mapping); if (!err || err == -EIO) { /* AS_EIO might trigger -EIO */ -#if 0 - struct fuse_dev *fud; - spin_lock(&fc->lock); - - /* - * Clean bg_queue first to prevent requests being flushed - * to an input queue after it has been cleaned . - */ - spin_lock(&fc->bg_lock); - fuse_kill_requests(fc, inode, &fc->bg_queue); - spin_unlock(&fc->bg_lock); - - if (fc->kio.op && fc->kio.op->kill_requests) - fc->kio.op->kill_requests(fc, inode); - - spin_lock(&fc->main_iq.lock); - fuse_kill_requests(fc, inode, &fc->main_iq.pending); - spin_unlock(&fc->main_iq.lock); - - fuse_kill_routing(&fc->rrt, fc, inode); - fuse_kill_routing(&fc->wrt, fc, inode); - - list_for_each_entry(fud, &fc->devices, entry) { - struct fuse_pqueue *fpq = &fud->pq; - struct fuse_iqueue *fiq = fud->fiq; - int i; - - spin_lock(&fiq->lock); - fuse_kill_requests(fc, inode, &fiq->pending); - spin_unlock(&fiq->lock); - - spin_lock(&fpq->lock); - for (i = 0; i < FUSE_PQ_HASH_SIZE; i++) - fuse_kill_requests(fc, inode, &fpq->processing[i]); - fuse_kill_requests(fc, inode, &fpq->io); - spin_unlock(&fpq->lock); - } - - spin_unlock(&fc->lock); -#endif spin_lock(&fi->lock); list_for_each_entry(ff, &fi->rw_files, rw_entry) fuse_revoke_readpages(ff); spin_unlock(&fi->lock); wake_up(&fi->page_waitq); /* readpage[s] can wait on fuse wb */ - err = invalidate_inode_pages2(inode->i_mapping); } diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c index 1b3bc8f455638..0a59271a6f124 100644 --- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c +++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c @@ -1797,21 +1797,6 @@ void pcs_kio_req_list(struct fuse_conn *fc, kio_req_itr kreq_cb, void *ctx) pcs_kio_file_list(fc, kpcs_req_list_itr, &kreq_ctx); } -static void kpcs_kill_lreq_itr(struct fuse_file *ff, struct pcs_dentry_info *di, - void *ctx) -{ - struct inode *inode = ctx; - - spin_lock(&di->kq_lock); - fuse_kill_requests(ff->fm->fc, inode, &di->kq); - spin_unlock(&di->kq_lock); -} - -static void kpcs_kill_requests(struct fuse_conn *fc, struct inode *inode) -{ - pcs_kio_file_list(fc, kpcs_kill_lreq_itr, inode); -} - static int pcs_process_dislog(struct pcs_cluster_core *cc, struct pcs_mds_cached_event *evt) { switch (evt->flags & PCS_MDS_EVT_F_OBJ_MASK) { @@ -2061,7 +2046,6 @@ static struct fuse_kio_ops kio_pcs_ops = { .file_open = kpcs_file_open, .file_close = kpcs_file_close, .inode_release = kpcs_inode_release, - .kill_requests = kpcs_kill_requests, .ioctl = kpcs_ioctl, .dev_ioctl = kpcs_dev_ioctl, }; _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel