[Devel] [PATCH RHEL7 COMMIT] fuse: don't declare FUSE FIEMAP support for any FUSE fs

Konstantin Khorenko khorenko at virtuozzo.com
Fri Dec 13 15:37:17 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-1062.7.1.vz7.130.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.7.1.vz7.130.3
------>
commit af50e08a4a35bffea6e71910bbb7fa00266095d0
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Thu Dec 12 16:44:14 2019 +0300

    fuse: don't declare FUSE FIEMAP support for any FUSE fs
    
    Stock kernels don't have FIEMAP support in fuse filesystems,
    we've added the support for FIEMAP for pStorage performance.
    
    Now if you call FIEMAP ioctl on a FUSE fs (for example mergerfs, sshfs,
    mhddfs), libfuse crashes (the function fuse_lib_ioctl aborts due to
    inbufsz > != outbufsz), so FIEMAP support autodetection does not work.
    
    Let's pretend we don't provide FIEMAP for any FUSE fs except for pStorage.
    
    https://bugs.openvz.org/browse/OVZ-7145
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/fuse/inode.c | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index fc5f066d3e4d9..7c8d9350d34d6 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1439,23 +1439,33 @@ static struct dentry *fuse_mount(struct file_system_type *fs_type,
 		       void *raw_data)
 {
 	struct dentry *dentry;
+	struct fuse_conn *fc;
 
 	dentry = mount_nodev(fs_type, flags, raw_data, fuse_fill_super);
+	if (IS_ERR(dentry))
+		return dentry;
+
+	fc = dentry->d_sb->s_fs_info;
 
-	/* Hack to distinguish pcs fuse service and to force synchronous close for it.
-	 * Seems, this is the only place where we have some variable (dev_name), which
-	 * is not confined by fuse API and already defined.
+	/* Hack to distinguish pcs fuse service and to force synchronous
+	 * close for it. Seems, this is the only place where we have some
+	 * variable (dev_name), which is not confined by fuse API and
+	 * already defined.
+	 *
+	 * libfuse is not ready for fiemap autodetection, so disable fiemap
+	 * support check in advance for all FUSE fs except for pStorage.
 	 */
-	if (!IS_ERR(dentry) && dev_name &&
-			(strncmp(dev_name, "pstorage://", 11) == 0 ||
-				strncmp(dev_name, "vstorage://", 11) == 0) ) {
-		struct fuse_conn *fc = dentry->d_sb->s_fs_info;
+	if (dev_name &&
+	    (strncmp(dev_name, "pstorage://", 11) == 0 ||
+	     strncmp(dev_name, "vstorage://", 11) == 0)) {
 
 		if (!(fc->flags & FUSE_DISABLE_CLOSE_WAIT))
 			fc->close_wait = 1;
 
 		fc->compat_inval_files = 1;
-	}
+	} else
+		fc->no_fiemap = 1;
+
 	return dentry;
 }
 



More information about the Devel mailing list