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