summaryrefslogtreecommitdiffstats
path: root/tests/basic
diff options
context:
space:
mode:
authorXavi Hernandez <xhernandez@redhat.com>2019-04-12 17:54:44 +0200
committerPranith Kumar Karampuri <pkarampu@redhat.com>2019-04-23 11:28:58 +0000
commit4f0db1373be93e05b6fc451d2f07514704d3c4ca (patch)
tree82f4d82fbe914bcee2e900a87281a681b6cd40fc /tests/basic
parent132f03a0b77980b25a8b499ad1fe1e4ab2aee40e (diff)
cluster/ec: fix fd reopen
Currently EC tries to reopen fd's that have been opened while a brick was down. This is done as part of regular write operations, just after having acquired the locks, and it's sent as a sub-fop of the main write fop. There were two problems: 1. The reopen was attempted on all UP bricks, even if a previous lock didn't succeed. This is incorrect because most probably the open will fail. 2. If reopen is sent and fails, the error is propagated to the main operation, causing it to fail when it shouldn't. To fix this, we only attempt reopens on bricks where the current fop owns a lock, and we prevent any error to be propagated to the main fop. To implement this behaviour an argument used to indicate the minimum number of required answers has overloaded to also include some flags. To make the change consistent, it has been necessary to rename the argument, which means that a lot of files have been changed. However there are no functional changes. This change has also uncovered a problem in discard code, which didn't correctely process requests of small sizes because no real discard fop was being processed, only a write of 0's on some region. In this case some fields of the fop remained uninitialized or with incorrect values. To fix this, a new function has been created to simulate success on a fop and it's used in the discard case. Thanks to Pranith for providing a test script that has also detected an issue in this patch. This patch includes a small modification of this script to force data to be written into bricks before stopping them. Change-Id: If272343873369186c2fb8f43c1d9c52c3ea304ec Fixes: bz#1699866 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
Diffstat (limited to 'tests/basic')
-rw-r--r--[-rwxr-xr-x]tests/basic/ec/self-heal-read-write-fail.t26
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/basic/ec/self-heal-read-write-fail.t b/tests/basic/ec/self-heal-read-write-fail.t
index a2b0562545c..0ba591b5bb2 100755..100644
--- a/tests/basic/ec/self-heal-read-write-fail.t
+++ b/tests/basic/ec/self-heal-read-write-fail.t
@@ -4,30 +4,34 @@
. $(dirname $0)/../../volume.rc
#This test verifies that self-heal fails when read/write fails as part of heal
-cleanup;
+cleanup
-TEST glusterd;
-TEST pidof glusterd;
-TEST $CLI volume info;
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume info
-TEST $CLI volume create $V0 disperse 3 redundancy 1 $H0:$B0/${V0}{0,1,2};
+TEST $CLI volume create $V0 disperse 3 redundancy 1 $H0:$B0/${V0}{0,1,2}
TEST $CLI volume heal $V0 disable
TEST $CLI volume start $V0
-TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
TEST touch $M0/a
TEST kill_brick $V0 $H0 $B0/${V0}0
echo abc >> $M0/a
+# Umount the volume to force all pending writes to reach the bricks
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
+
#Load error-gen and fail read fop and test that heal fails
TEST $CLI volume stop $V0 #Stop volume so that error-gen can be loaded
-TEST $CLI volume set $V0 debug.error-gen posix;
-TEST $CLI volume set $V0 debug.error-fops read;
+TEST $CLI volume set $V0 debug.error-gen posix
+TEST $CLI volume set $V0 debug.error-fops read
TEST $CLI volume set $V0 debug.error-number EBADF
TEST $CLI volume set $V0 debug.error-failure 100
TEST $CLI volume start $V0
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
EXPECT_WITHIN $HEAL_TIMEOUT "^2$" get_pending_heal_count $V0
TEST ! getfattr -n trusted.ec.heal $M0/a
@@ -35,7 +39,7 @@ EXPECT_WITHIN $HEAL_TIMEOUT "^2$" get_pending_heal_count $V0
#fail write fop and test that heal fails
TEST $CLI volume stop $V0
-TEST $CLI volume set $V0 debug.error-fops write;
+TEST $CLI volume set $V0 debug.error-fops write
TEST $CLI volume start $V0
EXPECT_WITHIN $CHILD_UP_TIMEOUT "3" ec_child_up_count $V0 0
@@ -58,8 +62,8 @@ EXPECT "^0$" get_pending_heal_count $V0
#Test that heal worked as expected by forcing read from brick0
#remount to make sure data is not served from any cache
EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
-TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0;
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
TEST kill_brick $V0 $H0 $B0/${V0}2
EXPECT "abc" cat $M0/a
-cleanup;
+cleanup