From 3d34c495d547866a533bc0614b14163381830095 Mon Sep 17 00:00:00 2001 From: Ashish Pandey Date: Wed, 17 Feb 2016 15:57:02 +0530 Subject: cluster/ec: Rebalance hangs during rename Problem: During the rename of a particular file (ec is holding blocking inodelk on the parent directory), if the rename of another file under the same directory comes. EC does not release the lock and goes ahead and renames the "new" file with the "already held lock". That causes rebalance process to be blocked on a lock which has been acquired by rename. Solution: While rename fop comes, ec takes blocking inodelk on old and new parent of the file. Before releasing, every lock held by ec, it waits for some "time" to see if that lock can be reused by the next fop. If within this "time" some other request comes, it releases this lock based on condition "lock count > 1" To get this "lock count" for rename fop, we have implemented "pl_rename" in feature/lock. Also, on ec side, changed the condition to release the lock based on the type of fop and old and new parent directories. master- http://review.gluster.org/#/c/13460/ Change-Id: I979dbab1185df962e8f305a6074ae1186ffe7db0 Bug: 1322299 Signed-off-by: Ashish Pandey Reviewed-on: http://review.gluster.org/13849 Smoke: Gluster Build System CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Pranith Kumar Karampuri --- tests/bugs/disperse/bug-1304988.t | 40 +++++++++++++++++++++++++++++++++++++++ tests/bugs/replicate/bug-921231.t | 0 2 files changed, 40 insertions(+) create mode 100755 tests/bugs/disperse/bug-1304988.t mode change 100644 => 100755 tests/bugs/replicate/bug-921231.t (limited to 'tests') diff --git a/tests/bugs/disperse/bug-1304988.t b/tests/bugs/disperse/bug-1304988.t new file mode 100755 index 00000000000..1a81dccdeae --- /dev/null +++ b/tests/bugs/disperse/bug-1304988.t @@ -0,0 +1,40 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +# This test renames files from dir to test and vice versa in an infinite loop +# at the same time add-brick and rebalance starts which should NOT be hanged + +cleanup; + +function rename_files { +while : +do + for i in {1..100}; do mv $M0/dir/file-$i $M0/test/newfile-$i; done + for i in {1..100}; do mv $M0/test/newfile-$i $M0/dir/file-$i; done +done +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5} +TEST $CLI volume start $V0 +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "6" ec_child_up_count $V0 0 + +mkdir $M0/dir +mkdir $M0/test +touch $M0/dir/file-{1..100} +rename_files & +back_pid1=$!; +echo "Started rename $back_pid1" + +TEST $CLI volume add-brick $V0 $H0:$B0/${V0}{6..11} +TEST $CLI volume rebalance $V0 start force + +#Test if rebalance completed with success. +EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" rebalance_status_field $V0 +echo "rebalance done..." +kill $back_pid1 +cleanup; diff --git a/tests/bugs/replicate/bug-921231.t b/tests/bugs/replicate/bug-921231.t old mode 100644 new mode 100755 -- cgit