|
|
e7a346 |
From aad0d32376e6ca56770e5c2d4dc5a1462b1e7167 Mon Sep 17 00:00:00 2001
|
|
|
e7a346 |
From: N Balachandran <nbalacha@redhat.com>
|
|
|
e7a346 |
Date: Thu, 13 Dec 2018 12:06:10 +0530
|
|
|
e7a346 |
Subject: [PATCH 457/493] cluster/dht: sync brick root perms on add brick
|
|
|
e7a346 |
|
|
|
e7a346 |
If a single brick is added to the volume and the
|
|
|
e7a346 |
newly added brick is the first to respond to a
|
|
|
e7a346 |
dht_revalidate call, its stbuf will not be merged
|
|
|
e7a346 |
into local->stbuf as the brick does not yet have
|
|
|
e7a346 |
a layout. The is_permission_different check therefore
|
|
|
e7a346 |
fails to detect that an attr heal is required as it
|
|
|
e7a346 |
only considers the stbuf values from existing bricks.
|
|
|
e7a346 |
To fix this, merge all stbuf values into local->stbuf
|
|
|
e7a346 |
and use local->prebuf to store the correct directory
|
|
|
e7a346 |
attributes.
|
|
|
e7a346 |
|
|
|
e7a346 |
upstream patch: https://review.gluster.org/#/c/glusterfs/+/21611/
|
|
|
e7a346 |
|
|
|
e7a346 |
> Change-Id: Ic9e8b04a1ab9ed1248b6b056e3450bbafe32e1bc
|
|
|
e7a346 |
> fixes: bz#1648298
|
|
|
e7a346 |
> Signed-off-by: N Balachandran <nbalacha@redhat.com>
|
|
|
e7a346 |
|
|
|
e7a346 |
Change-Id: I329ce48555d15f741d7247290e749f0800d12df8
|
|
|
e7a346 |
BUG: 1648296
|
|
|
e7a346 |
Signed-off-by: N Balachandran <nbalacha@redhat.com>
|
|
|
e7a346 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/158493
|
|
|
e7a346 |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e7a346 |
Reviewed-by: Susant Palai <spalai@redhat.com>
|
|
|
e7a346 |
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
|
|
|
e7a346 |
---
|
|
|
e7a346 |
tests/bugs/distribute/bug-1368012.t | 11 +++++------
|
|
|
e7a346 |
xlators/cluster/dht/src/dht-common.c | 26 ++++++++------------------
|
|
|
e7a346 |
2 files changed, 13 insertions(+), 24 deletions(-)
|
|
|
e7a346 |
|
|
|
e7a346 |
diff --git a/tests/bugs/distribute/bug-1368012.t b/tests/bugs/distribute/bug-1368012.t
|
|
|
e7a346 |
index b861554..0b62635 100644
|
|
|
e7a346 |
--- a/tests/bugs/distribute/bug-1368012.t
|
|
|
e7a346 |
+++ b/tests/bugs/distribute/bug-1368012.t
|
|
|
e7a346 |
@@ -15,7 +15,7 @@ TEST pidof glusterd;
|
|
|
e7a346 |
TEST $CLI volume info;
|
|
|
e7a346 |
|
|
|
e7a346 |
## Lets create volume
|
|
|
e7a346 |
-TEST $CLI volume create $V0 $H0:/${V0}{1,2};
|
|
|
e7a346 |
+TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2};
|
|
|
e7a346 |
|
|
|
e7a346 |
## Verify volume is created
|
|
|
e7a346 |
EXPECT "$V0" volinfo_field $V0 'Volume Name';
|
|
|
e7a346 |
@@ -36,17 +36,16 @@ TEST chmod 444 $M0
|
|
|
e7a346 |
TEST permission_root=`stat -c "%A" $M0`
|
|
|
e7a346 |
TEST echo $permission_root
|
|
|
e7a346 |
#Add-brick
|
|
|
e7a346 |
-TEST $CLI volume add-brick $V0 $H0:/${V0}3
|
|
|
e7a346 |
+TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3
|
|
|
e7a346 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "3" online_brick_count
|
|
|
e7a346 |
|
|
|
e7a346 |
#Allow one lookup to happen
|
|
|
e7a346 |
-TEST pushd $M0
|
|
|
e7a346 |
-TEST ls
|
|
|
e7a346 |
+TEST ls $M0
|
|
|
e7a346 |
#Generate another lookup
|
|
|
e7a346 |
echo 3 > /proc/sys/vm/drop_caches
|
|
|
e7a346 |
-TEST ls
|
|
|
e7a346 |
+TEST ls $M0
|
|
|
e7a346 |
#check root permission
|
|
|
e7a346 |
EXPECT_WITHIN "5" $permission_root get_permission $M0
|
|
|
e7a346 |
#check permission on the new-brick
|
|
|
e7a346 |
-EXPECT $permission_root get_permission /${V0}3
|
|
|
e7a346 |
+EXPECT $permission_root get_permission $B0/${V0}3
|
|
|
e7a346 |
cleanup
|
|
|
e7a346 |
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
|
|
|
e7a346 |
index d3a0c8b..2e19036 100644
|
|
|
e7a346 |
--- a/xlators/cluster/dht/src/dht-common.c
|
|
|
e7a346 |
+++ b/xlators/cluster/dht/src/dht-common.c
|
|
|
e7a346 |
@@ -1717,14 +1717,17 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
if (is_dir) {
|
|
|
e7a346 |
ret = dht_dir_has_layout (xattr, conf->xattr_name);
|
|
|
e7a346 |
if (ret >= 0) {
|
|
|
e7a346 |
- if (is_greater_time(local->stbuf.ia_ctime,
|
|
|
e7a346 |
- local->stbuf.ia_ctime_nsec,
|
|
|
e7a346 |
+ if (is_greater_time(local->prebuf.ia_ctime,
|
|
|
e7a346 |
+ local->prebuf.ia_ctime_nsec,
|
|
|
e7a346 |
stbuf->ia_ctime,
|
|
|
e7a346 |
stbuf->ia_ctime_nsec)) {
|
|
|
e7a346 |
/* Choose source */
|
|
|
e7a346 |
local->prebuf.ia_gid = stbuf->ia_gid;
|
|
|
e7a346 |
local->prebuf.ia_uid = stbuf->ia_uid;
|
|
|
e7a346 |
|
|
|
e7a346 |
+ local->prebuf.ia_ctime = stbuf->ia_ctime;
|
|
|
e7a346 |
+ local->prebuf.ia_ctime_nsec = stbuf->ia_ctime_nsec;
|
|
|
e7a346 |
+
|
|
|
e7a346 |
if (__is_root_gfid (stbuf->ia_gfid))
|
|
|
e7a346 |
local->prebuf.ia_prot = stbuf->ia_prot;
|
|
|
e7a346 |
}
|
|
|
e7a346 |
@@ -1792,22 +1795,9 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
e7a346 |
}
|
|
|
e7a346 |
}
|
|
|
e7a346 |
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- /* Update stbuf from the servers where layout is present. This
|
|
|
e7a346 |
- * is an indication that the server is not a newly added brick.
|
|
|
e7a346 |
- * Merging stbuf from newly added brick may result in the added
|
|
|
e7a346 |
- * brick being the source of heal for uid/gid */
|
|
|
e7a346 |
- if (!is_dir || (is_dir &&
|
|
|
e7a346 |
- dht_dir_has_layout (xattr, conf->xattr_name) >= 0)
|
|
|
e7a346 |
- || conf->subvolume_cnt == 1) {
|
|
|
e7a346 |
-
|
|
|
e7a346 |
- dht_iatt_merge (this, &local->stbuf, stbuf, prev);
|
|
|
e7a346 |
- dht_iatt_merge (this, &local->postparent, postparent,
|
|
|
e7a346 |
- prev);
|
|
|
e7a346 |
- } else {
|
|
|
e7a346 |
- /* copy the gfid anyway */
|
|
|
e7a346 |
- gf_uuid_copy (local->stbuf.ia_gfid, stbuf->ia_gfid);
|
|
|
e7a346 |
- }
|
|
|
e7a346 |
+ gf_uuid_copy (local->stbuf.ia_gfid, stbuf->ia_gfid);
|
|
|
e7a346 |
+ dht_iatt_merge (this, &local->stbuf, stbuf, prev);
|
|
|
e7a346 |
+ dht_iatt_merge (this, &local->postparent, postparent, prev);
|
|
|
e7a346 |
|
|
|
e7a346 |
local->op_ret = 0;
|
|
|
e7a346 |
|
|
|
e7a346 |
--
|
|
|
e7a346 |
1.8.3.1
|
|
|
e7a346 |
|