74096c
From 0fed8ca9c6c9e3a9041951bc748c7936d0abc8cf Mon Sep 17 00:00:00 2001
74096c
From: nik-redhat <nladha@redhat.com>
74096c
Date: Tue, 15 Sep 2020 16:20:19 +0530
74096c
Subject: [PATCH 491/511] glusterd: mount directory getting truncated on
74096c
 mounting shared_storage
74096c
74096c
Issue:
74096c
In case of a user created volume the mount point
74096c
is the brick path 'ex: /data/brick' but in case of
74096c
shared_storage the mount point is '/'.So, here
74096c
we increment the array by one so as to get the exact
74096c
path of brick without '/', which works fine for other
74096c
volumes as the pointer of the brick_dir variable is
74096c
at '/', but for shared_storage it is at 'v'(where v is
74096c
starting letter of 'var' directory). So, on incrementing
74096c
the path we get in case of shared_storage starts from
74096c
'ar/lib/glusterd/...'
74096c
74096c
Fix:
74096c
Only, increment the pointer if the current position is '/',
74096c
else the path will be wrong.
74096c
74096c
>Fixes: #1480
74096c
74096c
>Change-Id: Id31bb13f58134ae2099884fbc5984c4e055fb357
74096c
>Signed-off-by: nik-redhat <nladha@redhat.com>
74096c
74096c
Upstream patch: https://review.gluster.org/c/glusterfs/+/24989
74096c
74096c
BUG: 1878077
74096c
Change-Id: Id31bb13f58134ae2099884fbc5984c4e055fb357
74096c
Signed-off-by: nik-redhat <nladha@redhat.com>
74096c
Reviewed-on: https://code.engineering.redhat.com/gerrit/220536
74096c
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74096c
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74096c
---
74096c
 xlators/mgmt/glusterd/src/glusterd-utils.c | 3 ++-
74096c
 1 file changed, 2 insertions(+), 1 deletion(-)
74096c
74096c
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
74096c
index ad3750e..b343eee 100644
74096c
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
74096c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
74096c
@@ -1221,7 +1221,8 @@ glusterd_get_brick_mount_dir(char *brickpath, char *hostname, char *mount_dir)
74096c
         }
74096c
 
74096c
         brick_dir = &brickpath[strlen(mnt_pt)];
74096c
-        brick_dir++;
74096c
+        if (brick_dir[0] == '/')
74096c
+            brick_dir++;
74096c
 
74096c
         snprintf(mount_dir, VALID_GLUSTERD_PATHMAX, "/%s", brick_dir);
74096c
     }
74096c
-- 
74096c
1.8.3.1
74096c