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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2022-02-28 13:26:14 +01:00
parent 030faee28d
commit 3f2454ca0c

View 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;