[Devel] [PATCH RHEL7 COMMIT] fs/fuse: use kio file_close only on final inode close

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jul 18 15:29:24 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.21.3.vz7.106.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.21.3.vz7.106.6
------>
commit 80d09bf787460f9d7e650854e26a458a1042662a
Author: Alexey Kuznetsov <kuznet at virtuozzo.com>
Date:   Thu Jul 18 15:29:21 2019 +0300

    fs/fuse: use kio file_close only on final inode close
    
    kio.op->file_open is called only on the first open,
    hence kio.op->file_close must be called only on the last close.
    
    It is important, not only we see the warning, noticed in PSBM-96165,
    maps forcibly dropped in file_close can result in data corruption.
    
    Fixes: 9175828fad3e ("fs/fuse kio: drop maps on file close")
    https://jira.sw.ru/browse/PSBM-96165
    
    Signed-off-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
---
 fs/fuse/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 79e64069e06a..344f35562bbe 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -468,7 +468,7 @@ static int fuse_release(struct inode *inode, struct file *file)
 		mutex_lock(&inode->i_mutex);
 		fuse_sync_writes(inode);
 
-		if (ff->fc->kio.op->file_close)
+		if (fi->num_openers == 0 && ff->fc->kio.op->file_close)
 			ff->fc->kio.op->file_close(ff->fc, file, inode);
 		mutex_unlock(&inode->i_mutex);
 	}



More information about the Devel mailing list