From: Michal Privoznik Date: Mon, 28 Feb 2022 12:26:14 +0000 (+0100) Subject: lxc_fuse: Prefer fuse_file_info::direct_io over mount option X-Git-Tag: v8.2.0-rc1~176 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f2454ca0c9b033c070e865defe4134c0c209512;p=thirdparty%2Flibvirt.git lxc_fuse: Prefer fuse_file_info::direct_io over mount option 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 Reviewed-by: Ján Tomko --- diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index b068d21cf4..73d3ab1015 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -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;