[Devel] [PATCH RHEL7 COMMIT] fuse kio: Wait pending requests on final fput()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 18 18:55:14 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.21.1.vz7.50.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.21.1.vz7.50.13
------>
commit 18e53c4cd2ccb41b95fd18e01f8789a38ef03c33
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon Jun 18 18:55:14 2018 +0300

    fuse kio: Wait pending requests on final fput()
    
    FUSE_RELEASE makes pstorage-mount to drop lease of the file.
    If this happens, pending requests will never finish.
    So, this patch makes the requests to finish actually.
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/file.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a8badb889975..8b2c36292d75 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -460,6 +460,16 @@ static int fuse_release(struct inode *inode, struct file *file)
 		     &get_fuse_inode(inode)->state))
 		fuse_flush_mtime(file, ff, true);
 
+	if (ff->fc->kio.op) {
+		/*
+		 * Flush pending requests before FUSE_RELEASE makes userspace
+		 * to drop the lease of the file. Otherwise, they never finish.
+		 */
+		mutex_lock(&inode->i_mutex);
+		fuse_sync_writes(inode);
+		mutex_unlock(&inode->i_mutex);
+	}
+
 	fuse_release_common(file, FUSE_RELEASE);
 
 	/* return value is ignored by VFS */


More information about the Devel mailing list