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(a)redhat.com>
---
src/lxc/lxc_fuse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.34.1