summaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authorVijay Bellur <vbellur@redhat.com>2013-04-30 00:20:33 +0530
committerAnand Avati <avati@redhat.com>2013-04-30 20:11:37 -0700
commit7967e3e5cfd330190c2bcc45d3a111a1d563a7a0 (patch)
treec0927825df18dec5829c3dad81a5eb9469610733 /tests/bugs
parent3b1ecc6a7fd961c709e82862fd4760b223365863 (diff)
cluster/afr: Avoid self-healing extended attribute used by SELinux.
Since removexattr() fails to remove "security.selinux" in a system where SELinux is enforcing, xattr self-healing fails. As a consequence of this, user extended attributes are not being healed. Added a check in afr to prune SELinux xattr from the dictionary used for removing xattrs from the sink. Minor changes in tests and md-cache as well. Signed-off-by: Vijay Bellur <vbellur@redhat.com> Change-Id: I854bfc0098dde812ce2afe64b125ee40c04bdeb1 BUG: 957877 Reviewed-on: http://review.gluster.org/4905 Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/bug-874498.t22
-rw-r--r--tests/bugs/bug-957877.t31
2 files changed, 37 insertions, 16 deletions
diff --git a/tests/bugs/bug-874498.t b/tests/bugs/bug-874498.t
index a4121777d..0b5991011 100644
--- a/tests/bugs/bug-874498.t
+++ b/tests/bugs/bug-874498.t
@@ -1,5 +1,7 @@
#!/bin/bash
. $(dirname $0)/../include.rc
+. $(dirname $0)/../afr.rc
+
cleanup;
TEST glusterd
@@ -13,11 +15,11 @@ TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;
B0_hiphenated=`echo $B0 | tr '/' '-'`
kill -9 `cat /var/lib/glusterd/vols/$V0/run/$H0$B0_hiphenated-brick1.pid` ;
-
echo "GLUSTER FILE SYSTEM" > $M0/FILE1
echo "GLUSTER FILE SYSTEM" > $M0/FILE2
-FILEN=$B0"/brick2/.glusterfs/indices/xattrop/"
+FILEN=$B0"/brick2"
+XATTROP=$FILEN/.glusterfs/indices/xattrop
function get_gfid()
{
@@ -34,7 +36,7 @@ GFID_FILE2=`get_gfid $B0/brick2/FILE2`
count=0
-for i in `ls $FILEN`
+for i in `ls $XATTROP`
do
if [ "$i" == "$GFID_ROOT" ] || [ "$i" == "$GFID_FILE1" ] || [ "$i" == "$GFID_FILE2" ]
then
@@ -45,25 +47,13 @@ done
EXPECT "3" echo $count
-function count_entries()
-{
- val1=0
-##count the number of entries after self heal
- for g in `ls $1`
- do
- val1=$(( val1 + 1 ))
- done
-
- echo $val1;
-}
-
TEST $CLI volume start $V0 force
sleep 5
TEST $CLI volume heal $V0
##Expected number of entries are 0 in the .glusterfs/indices/xattrop directory
-EXPECT_WITHIN 60 '0' count_entries $FILEN;
+EXPECT_WITHIN 60 '0' count_sh_entries $FILEN;
TEST $CLI volume stop $V0;
TEST $CLI volume delete $V0;
diff --git a/tests/bugs/bug-957877.t b/tests/bugs/bug-957877.t
new file mode 100644
index 000000000..23aefea25
--- /dev/null
+++ b/tests/bugs/bug-957877.t
@@ -0,0 +1,31 @@
+#!/bin/bash
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../afr.rc
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
+TEST $CLI volume start $V0;
+
+TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;
+kill_brick $V0 $H0 $B0/${V0}0
+TEST touch $M0/f1
+TEST setfattr -n "user.foo" -v "test" $M0/f1
+
+BRICK=$B0"/${V0}1"
+
+TEST $CLI volume start $V0 force
+sleep 5
+TEST $CLI volume heal $V0
+
+# Wait for self-heal to complete
+EXPECT_WITHIN 30 '0' count_sh_entries $BRICK;
+
+TEST getfattr -n "user.foo" $B0/${V0}0/f1;
+
+TEST $CLI volume stop $V0;
+TEST $CLI volume delete $V0;
+
+cleanup;