233933
From 6198461bce7d264b71fe91e981aa3af3a19a8abe Mon Sep 17 00:00:00 2001
233933
From: N Balachandran <nbalacha@redhat.com>
233933
Date: Tue, 4 Jun 2019 14:51:44 +0530
233933
Subject: [PATCH 168/169] cluster/dht: Fix directory perms during selfheal
233933
233933
Fixed a bug in the revalidate code path that wiped out
233933
directory permissions if no mds subvol was found.
233933
233933
upstream: https://review.gluster.org/#/c/glusterfs/+/22813/
233933
233933
> Change-Id: I8b4239ffee7001493c59d4032a2d3062586ea115
233933
> fixes: bz#1716830
233933
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
233933
233933
BUG: 1716821
233933
Change-Id: I6d84d381d07a27d1ef9113a2104a62ceaf2110e3
233933
Signed-off-by: N Balachandran <nbalacha@redhat.com>
233933
Reviewed-on: https://code.engineering.redhat.com/gerrit/172622
233933
Tested-by: RHGS Build Bot <nigelb@redhat.com>
233933
Reviewed-by: Mohit Agrawal <moagrawa@redhat.com>
233933
---
233933
 xlators/cluster/dht/src/dht-common.c | 8 +++++---
233933
 1 file changed, 5 insertions(+), 3 deletions(-)
233933
233933
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
233933
index 183872f..e1edb38 100644
233933
--- a/xlators/cluster/dht/src/dht-common.c
233933
+++ b/xlators/cluster/dht/src/dht-common.c
233933
@@ -1739,9 +1739,11 @@ unlock:
233933
 
233933
             if (dht_needs_selfheal(frame, this)) {
233933
                 if (!__is_root_gfid(local->loc.inode->gfid)) {
233933
-                    local->stbuf.ia_gid = local->mds_stbuf.ia_gid;
233933
-                    local->stbuf.ia_uid = local->mds_stbuf.ia_uid;
233933
-                    local->stbuf.ia_prot = local->mds_stbuf.ia_prot;
233933
+                    if (local->mds_subvol) {
233933
+                        local->stbuf.ia_gid = local->mds_stbuf.ia_gid;
233933
+                        local->stbuf.ia_uid = local->mds_stbuf.ia_uid;
233933
+                        local->stbuf.ia_prot = local->mds_stbuf.ia_prot;
233933
+                    }
233933
                 } else {
233933
                     local->stbuf.ia_gid = local->prebuf.ia_gid;
233933
                     local->stbuf.ia_uid = local->prebuf.ia_uid;
233933
-- 
233933
1.8.3.1
233933