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

Alexey Kuznetsov kuznet at virtuozzo.com
Tue Jul 16 17:05:47 MSK 2024


https://pmc.acronis.work/browse/VSTOR-89251

Signed-off-by: Alexey Kuznetsov <kuznet at acronis.com>
---
 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 67cce34..e2133cc 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);
 }
 
-- 
1.8.3.1



More information about the Devel mailing list