[Devel] [PATCH RHEL9 COMMIT] fs/fuse: remove special treatment to killed requests

Konstantin Khorenko khorenko at virtuozzo.com
Mon Sep 15 17:05:13 MSK 2025


The commit is pushed to "branch-rh9-5.14.0-427.77.1.vz9.86.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.77.1.vz9.86.6
------>
commit b0ad65f857cfd8b0da7e8d0b8997802745827f56
Author: Liu Kui <kui.liu at virtuozzo.com>
Date:   Mon Sep 15 21:02:03 2025 +0800

    fs/fuse: remove special treatment to killed requests
    
    Now that pages from a killed request are no longer released, it's safe
    to write to these pages which though will be discarded later. However
    It makes the code simpler and cleaner without having to treat killed
    requests speciallly.
    
    Related to #VSTOR-101450
    Signed-off-by: Liu Kui <kui.liu at 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              | 18 +-----------------
 fs/fuse/kio/pcs/pcs_krpc.c |  2 +-
 2 files changed, 2 insertions(+), 18 deletions(-)

diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 99bb359cf4ad8..5f19af552cb55 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1979,11 +1979,6 @@ static int copy_out_args(struct fuse_copy_state *cs, struct fuse_args *args,
 {
 	unsigned reqsize = sizeof(struct fuse_out_header);
 
-	if (unlikely(args->killed)) {
-		cs->req->out.h.error = -EIO;
-		return 0;
-	}
-
 	reqsize += fuse_len_args(args->out_numargs, args->out_args);
 
 	if (reqsize < nbytes || (reqsize > nbytes && !args->out_argvar))
@@ -2079,9 +2074,6 @@ static int copy_out_splices(struct fuse_copy_state *cs, struct fuse_args *args,
 				int ioff = pipe->bufs[tail & mask].offset;
 				int ilen = pipe->bufs[tail & mask].len;
 
-				if (unlikely(args->killed))
-					goto skip_copy;
-
 				while (ilen > 0) {
 					int copy = ilen;
 
@@ -2106,7 +2098,6 @@ static int copy_out_splices(struct fuse_copy_state *cs, struct fuse_args *args,
 					ioff += copy;
 					ilen -= copy;
 				}
-skip_copy:
 				put_page(ipage);
 				pipe->bufs[tail & mask].ops = NULL;
 				pipe->bufs[tail & mask].page = NULL;
@@ -2121,9 +2112,7 @@ static int copy_out_splices(struct fuse_copy_state *cs, struct fuse_args *args,
 		}
 	}
 
-	if (unlikely(args->killed)) {
-		cs->req->out.h.error = -EIO;
-	} else if (args->page_zeroing && didx < ap->num_pages) {
+	if (args->page_zeroing && didx < ap->num_pages) {
 		if (doff < dend) {
 			void *dst = kmap_atomic(dpage);
 
@@ -2163,11 +2152,6 @@ static int copy_out_krpczc(struct fuse_copy_state *cs, struct fuse_args *args,
 	void *dst;
 	int err;
 
-	if (unlikely(args->killed)) {
-		cs->req->out.h.error = -EIO;
-		return 0;
-	}
-
 	if (args->out_numargs != 1 || !args->out_pages)
 		return -EINVAL;
 
diff --git a/fs/fuse/kio/pcs/pcs_krpc.c b/fs/fuse/kio/pcs/pcs_krpc.c
index 8886fa5501ed0..e8c924c1a5da4 100644
--- a/fs/fuse/kio/pcs/pcs_krpc.c
+++ b/fs/fuse/kio/pcs/pcs_krpc.c
@@ -569,7 +569,7 @@ static int kreq_make_sendmsg(struct krpc_req *kreq)
 			chunk->type = KRPC_CHUNK_TYPE_ZC;
 			chunk->addr = chunk_bdzc->offset;
 			chunk->req = fuse_dev_find_request(chunk_bdzc->devfd, chunk_bdzc->unique);
-			if (!chunk->req || chunk->req->args->killed) {
+			if (!chunk->req) {
 				res = PCS_ERR_INV_PARAMS;
 				goto err_free_data_chunk;
 			}


More information about the Devel mailing list