diff options
-rwxr-xr-x | tests/bugs/bug-1086228.t | 34 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix.c | 14 |
2 files changed, 41 insertions, 7 deletions
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 diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index cd9889260ee..0bf6c6f57ff 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -527,27 +527,27 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this, goto out; } - if (valid & GF_SET_ATTR_MODE) { - op_ret = posix_do_fchmod (this, pfd->fd, stbuf); + if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) { + op_ret = posix_do_fchown (this, pfd->fd, stbuf, valid); if (op_ret == -1) { op_errno = errno; gf_log (this->name, GF_LOG_ERROR, - "fsetattr (fchmod) failed on fd=%p: %s", + "fsetattr (fchown) failed on fd=%p: %s", fd, strerror (op_errno)); goto out; } + } - if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)) { - op_ret = posix_do_fchown (this, pfd->fd, stbuf, valid); + if (valid & GF_SET_ATTR_MODE) { + op_ret = posix_do_fchmod (this, pfd->fd, stbuf); if (op_ret == -1) { op_errno = errno; gf_log (this->name, GF_LOG_ERROR, - "fsetattr (fchown) failed on fd=%p: %s", + "fsetattr (fchmod) failed on fd=%p: %s", fd, strerror (op_errno)); goto out; } - } if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) { |