summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-selfheal.c
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2016-08-17 15:10:04 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-09-11 21:57:03 -0700
commit801cd07a4c6ec65ff930b2ae6bb5e405ccd03334 (patch)
treee3ec278566fbf65abff9d1e39da3b06150a090cd /xlators/cluster/dht/src/dht-selfheal.c
parented430fc04e57c89d08cfdd1bb5e408c5baf53adf (diff)
cluster/dht: heal root permission post add-brick
Post add-brick event the new brick will have permission of 755 by default. If the root directory permission was other than 755, that does not get healed to the new brick leading to permission errors/inconsistencies. For choosing source of attr heal we can trust the subvols which have layouts with latest ctime(as part of missing directory heal, we heal the proper attr). In case none of the subvols have layout, return ESTALE to retrigger a fresh lookup. Note: This patch heals the permission of the root directories only. Since, permission healing of directory is not straight forward and required intrusive fix, those are not addressed here. Change-Id: If894e3895d070d46b62d2452e52c1eaafcf56c29 BUG: 1368012 Signed-off-by: Susant Palai <spalai@redhat.com> Reviewed-on: http://review.gluster.org/15195 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-selfheal.c')
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index bd4c236..331878b 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -2253,11 +2253,19 @@ dht_dir_attr_heal (void *data)
for (i = 0; i < call_cnt; i++) {
subvol = conf->subvolumes[i];
- if (!subvol || (subvol == dht_first_up_subvol (this)))
+ if (!subvol)
continue;
- ret = syncop_setattr (subvol, &local->loc, &local->stbuf,
- (GF_SET_ATTR_UID | GF_SET_ATTR_GID),
- NULL, NULL, NULL, NULL);
+
+ if (__is_root_gfid (local->stbuf.ia_gfid)) {
+ ret = syncop_setattr (subvol, &local->loc, &local->stbuf,
+ (GF_SET_ATTR_UID | GF_SET_ATTR_GID | GF_SET_ATTR_MODE),
+ NULL, NULL, NULL, NULL);
+ } else {
+ ret = syncop_setattr (subvol, &local->loc, &local->stbuf,
+ (GF_SET_ATTR_UID | GF_SET_ATTR_GID),
+ NULL, NULL, NULL, NULL);
+ }
+
if (ret) {
gf_uuid_unparse(local->loc.gfid, gfid);