From 3e0a9c04ed86153a2822b92d69b31e20ef5c63f6 Mon Sep 17 00:00:00 2001 From: Venkatesh Somyajulu Date: Fri, 14 Nov 2014 12:06:39 +0530 Subject: posix: Changed order of chown and chmod Problem: Rebalance process runs in the root mode. If a normal user create a file and if it requires migration then because the migrated file is created by root, its owner and mode should be changed to the source normal user and permission should be changed the previous mode. If the suid bit is also set, then at the destination suid bit should also be set. Two operations are performed in the given order: 1. chmod 2. chown But chown resets the suid bit. So changed the order of these two operations so that first chown will be performed and then chmod will be performd so that suid bit will be preserved. Change-Id: Ib63b5cf528f8336b69bf090ad43bb02eec1d1602 BUG: 1086228 Signed-off-by: Venkatesh Somyajulu Reviewed-on: http://review.gluster.org/7435 Reviewed-by: Niels de Vos Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- tests/bugs/bug-1086228.t | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tests/bugs/bug-1086228.t (limited to 'tests/bugs') diff --git a/tests/bugs/bug-1086228.t b/tests/bugs/bug-1086228.t new file mode 100755 index 00000000000..4c77a851b88 --- /dev/null +++ b/tests/bugs/bug-1086228.t @@ -0,0 +1,34 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc +. $(dirname $0)/../fileio.rc +. $(dirname $0)/../dht.rc +cleanup; + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2} +TEST $CLI volume start $V0; +TEST glusterfs --direct-io-mode=yes --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; + +echo "D" > $M0/file1; +TEST chmod +st $M0/file1; + +TEST $CLI volume add-brick $V0 $H0:$B0/${V0}"3" +TEST $CLI volume rebalance $V0 start force + +EXPECT_WITHIN "10" "0" rebalance_completed +count=0 +for i in `ls $B0/$V0"3"`; + do + var=`stat -c %A $B0/$V0"3"/$i | cut -c 4`; + echo $B0/$V0"3"/$i $var + if [ "$var" != "S" ]; then + count=$((count + 1)) + fi + done + +TEST [[ $count == 0 ]] +cleanup -- cgit