diff options
author | Prashanth Pai <ppai@redhat.com> | 2014-07-22 18:49:44 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-02-19 03:33:21 -0800 |
commit | 7847db9a6dc560cb0078bdfdb0ac0187e8a79443 (patch) | |
tree | d48bcd20f51fe230e67a114aa5faac5902514bd0 | |
parent | ee9b0aab614b56aa8f3c8ed56ced88f769c0ee47 (diff) |
posix: Fix unlink failing under specific condition
PROBLEM:
Files are undeletable when these three conditions are met:
1. File does not have trusted.pgfid.<gfid> xattr set.
This won't be set when build-pgfid is off (default).
2. File has hardlink count > 1.
3. build-pgfid option is turned on.
FIX:
Allow unlink on files not having trusted.pgfid.<gfid> xattr.
Change-Id: I58a9d9a1b29a0cb07f4959daabbd6dd04fab2b34
BUG: 1122028
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Reviewed-on: http://review.gluster.org/8352
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Tested-by: Raghavendra G <rgowdapp@redhat.com>
-rwxr-xr-x | tests/bugs/bug-1122028.t | 51 | ||||
-rw-r--r-- | xlators/storage/posix/src/posix.c | 4 |
2 files changed, 54 insertions, 1 deletions
diff --git a/tests/bugs/bug-1122028.t b/tests/bugs/bug-1122028.t new file mode 100755 index 00000000000..baf431e2a9c --- /dev/null +++ b/tests/bugs/bug-1122028.t @@ -0,0 +1,51 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info + +# Create a 1x1 distributed volume +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +EXPECT 'Created' volinfo_field $V0 'Status' + +# Start volume +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status' + +# Mount volume over FUSE +TEST glusterfs -s $H0 --volfile-id $V0 $M0 + +TEST mkdir $M0/dir +TEST touch $M0/dir/a +TEST ln $M0/dir/a $M0/dir/b + +# Confirm hardlinks +inum1=$(ls -i $M0/dir/a | cut -d' ' -f1) +inum2=$(ls -i $M0/dir/b | cut -d' ' -f1) +TEST [ "$inum1" = "$inum2" ] + +# Turn on build-pgfid +TEST $CLI volume set $V0 build-pgfid on +EXPECT 'on' volinfo_field $V0 'storage.build-pgfid' + +# Unlink files +TEST unlink $M0/dir/a +TEST unlink $M0/dir/b + +# Unmount +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +# Stop the volume +TEST $CLI volume stop $V0; +EXPECT 'Stopped' volinfo_field $V0 'Status'; + +# Delete the volume +TEST $CLI volume delete $V0; +TEST ! $CLI volume info $V0; + +cleanup diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index b712ab3f5e8..04b75d083e1 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1586,7 +1586,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this, gf_log (this->name, GF_LOG_WARNING, "modification of " "parent gfid xattr failed (path:%s gfid:%s)", real_path, uuid_utoa (loc->inode->gfid)); - goto out; + if (op_errno != ENOATTR) + /* Allow unlink if pgfid xattr is not set. */ + goto out; } } |