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