[Virtio-fs] [PATCH 4/5] virtiofsd: Open lo->source while setting up root in sandbox=NONE mode
Vivek Goyal
vgoyal at redhat.com
Wed Jul 29 22:14:09 UTC 2020
In sandbox=NONE mode, lo->source points to the directory which is being
exported. We have not done any chroot()/pivot_root(). So open lo->source.
Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
---
tools/virtiofsd/passthrough_ll.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index 76ef891105..a6fa816b6c 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -3209,7 +3209,10 @@ static void setup_root(struct lo_data *lo, struct lo_inode *root)
int fd, res;
struct stat stat;
- fd = open("/", O_PATH);
+ if (lo->sandbox == SANDBOX_NONE)
+ fd = open(lo->source, O_PATH);
+ else
+ fd = open("/", O_PATH);
if (fd == -1) {
fuse_log(FUSE_LOG_ERR, "open(%s, O_PATH): %m\n", lo->source);
exit(1);
--
2.25.4
More information about the Virtio-fs
mailing list