Blob Blame History Raw
From 717ad177bb1e8ed0a100022669874a45b3c76d22 Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Wed, 27 Sep 2017 12:42:53 +0530
Subject: [PATCH 622/622] mount/fuse: Include sub-directory in source argument
 for mount()

With this, mount of a sub-directory 'foo' gets listed in /proc/mounts as:

<hostname>:<volname>/foo on /mnt/glusterfs type fuse.glusterfs (rw,relatime...)

> Upstream:
> Signed-off-by: Vijay Bellur <vbellur@redhat.com>
> BUG: 1488913
> Reviewed-on: https://review.gluster.org/18210
> Reviewed-by: Niels de Vos <ndevos@redhat.com>
> Reviewed-by: Amar Tumballi <amarts@redhat.com>

BUG: 1017362
Change-Id: Ib5977a7a21dd4e139d81f2352836e67f09fe90a1
Signed-Off-By: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/119139
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/mount/fuse/src/fuse-bridge.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index a8d936d..6fe52dc 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -5677,9 +5677,13 @@ init (xlator_t *this_xl)
         fsname = cmd_args->volfile;
         if (!fsname && cmd_args->volfile_server) {
                 if (cmd_args->volfile_id) {
+                        int dir_len = 0;
+                        if (cmd_args->subdir_mount)
+                                dir_len = strlen (cmd_args->subdir_mount) + 1;
                         fsname = GF_MALLOC (
                                    strlen (cmd_args->volfile_server) + 1 +
-                                   strlen (cmd_args->volfile_id) + 1,
+                                   strlen (cmd_args->volfile_id) + 1 +
+                                   dir_len,
                                    gf_fuse_mt_fuse_private_t);
                         if (!fsname) {
                                 gf_log ("glusterfs-fuse", GF_LOG_ERROR,
@@ -5690,6 +5694,8 @@ init (xlator_t *this_xl)
                         strcpy (fsname, cmd_args->volfile_server);
                         strcat (fsname, ":");
                         strcat (fsname, cmd_args->volfile_id);
+                        if (dir_len)
+                                strcat (fsname, cmd_args->subdir_mount);
                 } else
                         fsname = cmd_args->volfile_server;
         }
-- 
1.8.3.1