summaryrefslogtreecommitdiffstats
path: root/tests/bugs/bug-821056.t
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2013-01-11 17:39:20 +0530
committerAnand Avati <avati@redhat.com>2013-02-03 11:35:49 -0800
commit5fa1ebe63611759d30d9dec7bd54c879d5e1e420 (patch)
tree1529118f7a192949cf29ae1a65a4a96c8209c34a /tests/bugs/bug-821056.t
parent5c01280de7ce1a5f4608c7d6b5f6b4fcbf68523e (diff)
test: test re-opens of open-fds
Change-Id: Ic99c7f3cf1f6a381b0fc1b2ca1acc19f5fe75523 BUG: 821056 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/4387 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'tests/bugs/bug-821056.t')
-rw-r--r--tests/bugs/bug-821056.t48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/bugs/bug-821056.t b/tests/bugs/bug-821056.t
new file mode 100644
index 00000000000..ee4463e2cc1
--- /dev/null
+++ b/tests/bugs/bug-821056.t
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
+TEST $CLI volume set $V0 cluster.self-heal-daemon off
+TEST $CLI volume set $V0 performance.quick-read off
+TEST $CLI volume set $V0 performance.io-cache off
+TEST $CLI volume set $V0 performance.write-behind off
+TEST $CLI volume set $V0 performance.stat-prefetch off
+TEST $CLI volume set $V0 performance.read-ahead off
+TEST $CLI volume set $V0 cluster.background-self-heal-count 0
+TEST $CLI volume start $V0
+TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id=$V0 $M0 --direct-io-mode=enable
+touch $M0/a
+
+#Open file with fd as 5
+exec 5>$M0/a
+realpath=$(gf_get_gfid_backend_file_path $B0/${V0}0 "a")
+
+kill_brick $V0 $H0 $B0/${V0}0
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN 20 "1" afr_child_up_status $V0 0
+
+EXPECT "Y" gf_check_file_opened_in_brick $V0 $H0 $B0/${V0}0 "$realpath"
+
+kill_brick $V0 $H0 $B0/${V0}0
+TEST gf_rm_file_and_gfid_link $B0/${V0}0 "a"
+TEST $CLI volume start $V0 force
+EXPECT_WITHIN 20 "1" afr_child_up_status $V0 0
+ls -l $M0/a 2>&1 > /dev/null #Make sure the file is re-created
+EXPECT "N" gf_check_file_opened_in_brick $V0 $H0 $B0/${V0}0 "$realpath"
+EXPECT "N" gf_check_file_opened_in_brick $V0 $H0 $B0/${V0}0 $B0/${V0}0/a
+
+for i in {1..1024}; do
+ echo "open sesame" >&5
+done
+
+EXPECT_WITHIN 20 "Y" gf_check_file_opened_in_brick $V0 $H0 $B0/${V0}0 $B0/${V0}0/a
+#close the fd
+exec 5>&-
+
+cleanup;