]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
lxc_fuse: Prefer fuse_file_info::direct_io over mount option
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 28 Feb 2022 12:26:14 +0000 (13:26 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 7 Mar 2022 13:01:48 +0000 (14:01 +0100)
When mounting a FUSE it is possible to bypass kernel cache by
specifying -odirect_io mount option. This is what we currently
do. However, FUSEv3 has a different approach - the open callback
(lxcProcOpen() in our case) can set direct_io member of
fuse_file_info struct. This results in the same behaviour, but
also works with both FUSEv1 and FUSEv3. The latter does not have
the mount option and uses per file approach.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/lxc/lxc_fuse.c

index b068d21cf4f090713cf0379d2a853c73b4a7b4a9..73d3ab10151eddc9d4039ad151694cc92f1393e9 100644 (file)
@@ -117,6 +117,7 @@ lxcProcOpen(const char *path,
     if ((fi->flags & O_ACCMODE) != O_RDONLY)
         return -EACCES;
 
+    fi->direct_io = 1;
     return 0;
 }
 
@@ -329,7 +330,6 @@ lxcSetupFuse(struct virLXCFuse **f,
 
     /* process name is libvirt_lxc */
     if (fuse_opt_add_arg(&args, "libvirt_lxc") == -1 ||
-        fuse_opt_add_arg(&args, "-odirect_io") == -1 ||
         fuse_opt_add_arg(&args, "-oallow_other") == -1 ||
         fuse_opt_add_arg(&args, "-ofsname=libvirt") == -1)
         goto error;