[Devel] [PATCH RHEL8 COMMIT] fuse: illegal access to file in vstorage

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 21 12:59:52 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.46
------>
commit 7da7fa103151ca56a52d7c60a412927d26ee4fe4
Author: Alexey Kuznetsov <kuznet at acronis.com>
Date:   Sun Jun 20 17:06:56 2021 +0000

    fuse: illegal access to file in vstorage
    
    Actually, this improvement appeared first in the last update to RHEL7.
    If we ever hit this piece of code, we will request write access to
    a file, which has already been closed.
    
    The patch can be backported to VZ7, such accidents were reported,
    however I was not able to reproduce this in lab, so that the action
    is postponed.
    
    In the scope of https://jira.sw.ru/browse/PSBM-129289
    
    Signed-off-by: Alexey Kuznetsov <kuznet at acronis.com>
    
    khorenko@: the WARN_ON() will be substituted with pr_warn() later.
    Fow now WANR_ON() is left for debugging purposes.
---
 fs/fuse/file.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 69d48750a641..fc7e390f8b46 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -2112,6 +2112,10 @@ int fuse_write_inode(struct inode *inode, struct writeback_control *wbc)
 	int err;
 
 	ff = __fuse_write_file_get(fc, fi);
+	if (!ff && fc->close_wait) {
+		WARN_ON(1);
+		return 0;
+	}
 	err = fuse_flush_times(inode, ff);
 	if (ff)
 		fuse_file_put(ff, false, false);


More information about the Devel mailing list