[Devel] [PATCH RHEL9 COMMIT] fs: fuse: double completion when lease is lost

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jul 18 20:00:32 MSK 2024


The commit is pushed to "branch-rh9-5.14.0-427.22.1.vz9.62.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.22.1.vz9.62.6
------>
commit b3050589663f7fb1d456bf8520b0d57ddd1f6226
Author: Alexey Kuznetsov <kuznet at virtuozzo.com>
Date:   Tue Jul 16 22:05:47 2024 +0800

    fs: fuse: double completion when lease is lost
    
    https://pmc.acronis.work/browse/VSTOR-89251
    
    Fixes: 2d23aac3630e ("fuse: fix writeback/release race")
    Signed-off-by: Alexey Kuznetsov <kuznet at acronis.com>
    
    khorenko@: we assume here args->end is always setup.
    i'm not 100% sure about that, but dropping the check intentionally for now - if
    we ever face a crash here due to NULL ->end, we'll have to rewrite the code.
    Anyway the crash will be easy to understand.
    
    Feature: vStorage
---
 fs/fuse/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 67cce341426c..e2133ccde857 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2384,11 +2384,13 @@ static void fuse_writepages_send(struct fuse_fill_wb_data *data)
 	struct fuse_inode *fi = get_fuse_inode(inode);
 	int num_pages = wpa->ia.ap.num_pages;
 	struct fuse_args *args = &wpa->ia.ap.args;
+	int shoot_on_sight = 0;
 	int i;
 
 	wpa->ia.ff = fuse_file_get(data->ff);
 	spin_lock(&fi->lock);
 	if (test_bit(FUSE_S_FAIL_IMMEDIATELY, &data->ff->ff_state)) {
+		shoot_on_sight = 1;
 		fi->writectr++;
 	} else {
 		list_add_tail(&wpa->queue_entry, &fi->queued_writes);
@@ -2399,7 +2401,7 @@ static void fuse_writepages_send(struct fuse_fill_wb_data *data)
 	for (i = 0; i < num_pages; i++)
 		end_page_writeback(data->orig_pages[i]);
 
-	if (test_bit(FUSE_S_FAIL_IMMEDIATELY, &data->ff->ff_state) && args->end)
+	if (shoot_on_sight)
 		args->end(fm, args, -EIO);
 }
 


More information about the Devel mailing list