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