Otherwise we will fail to mount the meminfo file.
This patch also allows any users to access the
fuse mount point.
Signed-off-by: Gao feng <gaofeng(a)cn.fujitsu.com>
---
src/lxc/lxc_fuse.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index b6808da..2517340 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -48,6 +48,9 @@ static int lxcProcGetattr(const char *path, struct stat *stbuf)
char *mempath = NULL;
struct stat sb;
+ struct fuse_context *context = fuse_get_context();
+ virDomainDefPtr def = (virDomainDefPtr)context->private_data;
+
memset(stbuf, 0, sizeof(struct stat));
if (virAsprintf(&mempath, "/proc/%s", path) < 0) {
virReportOOMError();
@@ -65,6 +68,8 @@ static int lxcProcGetattr(const char *path, struct stat *stbuf)
goto cleanup;
}
+ stbuf->st_uid = def->os.uidmap.low_first;
+ stbuf->st_gid = def->os.gidmap.low_first;
stbuf->st_mode = sb.st_mode;
stbuf->st_nlink = 1;
stbuf->st_blksize = sb.st_blksize;
@@ -306,6 +311,7 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def)
/* 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 cleanup1;
--
1.7.11.7