From a9ee05a6673486ef86f36a87e00d144cfb56cf9b Mon Sep 17 00:00:00 2001 From: Susant Palai Date: Wed, 17 Aug 2016 15:10:04 +0530 Subject: 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. > Reviewed-on: http://review.gluster.org/15195 > Smoke: Gluster Build System > CentOS-regression: Gluster Build System > NetBSD-regression: NetBSD Build System >Reviewed-by: Raghavendra G (cherry picked from commit 801cd07a4c6ec65ff930b2ae6bb5e405ccd03334) Change-Id: If894e3895d070d46b62d2452e52c1eaafcf56c29 BUG: 1374573 Signed-off-by: Susant Palai Reviewed-on: http://review.gluster.org/15465 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Raghavendra G --- tests/bugs/distribute/bug-1368012.t | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/bugs/distribute/bug-1368012.t (limited to 'tests') diff --git a/tests/bugs/distribute/bug-1368012.t b/tests/bugs/distribute/bug-1368012.t new file mode 100644 index 00000000000..f89314b1f2e --- /dev/null +++ b/tests/bugs/distribute/bug-1368012.t @@ -0,0 +1,50 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function get_permission { + stat -c "%A" $1 +} + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +## Lets create volume +TEST $CLI volume create $V0 $H0:/${V0}{1,2}; + +## Verify volume is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +## Start volume and verify +TEST $CLI volume start $V0; +TEST $CLI volume set $V0 performance.stat-prefetch off +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST glusterfs -s $H0 --volfile-id=$V0 $M0 + +##Test case: Add-brick +#------------------------------------------------------------ +#change permission of both root +TEST chmod 444 $M0 + +#store permission for comparision +TEST permission_root=`stat -c "%A" $M0` +TEST echo $permission_root +#Add-brick +TEST $CLI volume add-brick $V0 $H0:/${V0}3 + +#Allow one lookup to happen +TEST pushd $M0 +TEST ls +#Generate another lookup +echo 3 > /proc/sys/vm/drop_caches +TEST ls +#check root permission +EXPECT_WITHIN "5" $permission_root get_permission $M0 +#check permission on the new-brick +EXPECT $permission_root get_permission /${V0}3 +cleanup -- cgit