summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2019-03-27 10:07:11 +0530
committerRaghavendra G <rgowdapp@redhat.com>2019-03-27 10:48:12 +0530
commit7cbf23bbc61879e7af70bbb2b42951a73966f3c6 (patch)
treef7e8ac0c2536f4a4d47b157cbb380ac81dca6b0c /xlators/cluster
parent2a872bbcdedb6218e666ebcd1827d59a99912eb1 (diff)
cluster/dht: sync brick root perms on add brick
If a single brick is added to the volume and the newly added brick is the first to respond to a dht_revalidate call, its stbuf will not be merged into local->stbuf as the brick does not yet have a layout. The is_permission_different check therefore fails to detect that an attr heal is required as it only considers the stbuf values from existing bricks. To fix this, merge all stbuf values into local->stbuf and use local->prebuf to store the correct directory attributes. Change-Id: Ic9e8b04a1ab9ed1248b6b056e3450bbafe32e1bc fixes: bz#1693057 Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-common.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 5a5ddacd7f6..561e75d0415 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -1659,14 +1659,17 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (is_dir) {
ret = dht_dir_has_layout (xattr, conf->xattr_name);
if (ret >= 0) {
- if (is_greater_time(local->stbuf.ia_ctime,
- local->stbuf.ia_ctime_nsec,
+ if (is_greater_time(local->prebuf.ia_ctime,
+ local->prebuf.ia_ctime_nsec,
stbuf->ia_ctime,
stbuf->ia_ctime_nsec)) {
/* Choose source */
local->prebuf.ia_gid = stbuf->ia_gid;
local->prebuf.ia_uid = stbuf->ia_uid;
+ local->prebuf.ia_ctime = stbuf->ia_ctime;
+ local->prebuf.ia_ctime_nsec = stbuf->ia_ctime_nsec;
+
if (__is_root_gfid (stbuf->ia_gfid))
local->prebuf.ia_prot = stbuf->ia_prot;
}
@@ -1734,22 +1737,9 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
-
- /* Update stbuf from the servers where layout is present. This
- * is an indication that the server is not a newly added brick.
- * Merging stbuf from newly added brick may result in the added
- * brick being the source of heal for uid/gid */
- if (!is_dir || (is_dir &&
- dht_dir_has_layout (xattr, conf->xattr_name) >= 0)
- || conf->subvolume_cnt == 1) {
-
- dht_iatt_merge (this, &local->stbuf, stbuf, prev);
- dht_iatt_merge (this, &local->postparent, postparent,
- prev);
- } else {
- /* copy the gfid anyway */
- gf_uuid_copy (local->stbuf.ia_gfid, stbuf->ia_gfid);
- }
+ gf_uuid_copy (local->stbuf.ia_gfid, stbuf->ia_gfid);
+ dht_iatt_merge (this, &local->stbuf, stbuf, prev);
+ dht_iatt_merge (this, &local->postparent, postparent, prev);
local->op_ret = 0;