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