[Devel] [PATCH VZ10 2/2] fs/fuse kio: Set FUSE_S_FAIL_IMMEDIATELY bit on newly opened fuse_file correctly
Liu Kui
kui.liu at virtuozzo.com
Tue Dec 16 12:26:05 MSK 2025
When fuse_invalidate_file() is in progress, set the FUSE_S_FAIL_IMMEDIATELY
bit on the newly created fuse_file before adding it to fi->rw_files list.
This prevents the page cache from issuing new read requests with locked
pages during fuse_invalidate_file(), which could otherwise cause a deadlock.
https://virtuozzo.atlassian.net/browse/VSTOR-120952
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
fs/fuse/file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 28e6b3c1aa06..5722cd441431 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -252,6 +252,11 @@ static void fuse_link_rw_file(struct file *file)
struct fuse_file *ff = file->private_data;
spin_lock(&fi->lock);
+ if (test_bit(FUSE_I_INVAL_FILES, &fi->state)) {
+ spin_lock(&ff->lock);
+ set_bit(FUSE_S_FAIL_IMMEDIATELY, &ff->ff_state);
+ spin_unlock(&ff->lock);
+ }
if (list_empty(&ff->rw_entry))
list_add(&ff->rw_entry, &fi->rw_files);
spin_unlock(&fi->lock);
--
2.39.5 (Apple Git-154)
More information about the Devel
mailing list