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