diff options
Diffstat (limited to 'tests/bugs/core')
25 files changed, 1046 insertions, 0 deletions
diff --git a/tests/bugs/core/949327.t b/tests/bugs/core/949327.t new file mode 100644 index 00000000000..6b8033a5c85 --- /dev/null +++ b/tests/bugs/core/949327.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function tmp_file_count() +{ + echo $(ls -lh /tmp/tmp.* 2>/dev/null | wc -l) +} + + +old_count=$(tmp_file_count); +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 +TEST $CLI volume start $V0 +new_count=$(tmp_file_count); + +TEST [ "$old_count" -eq "$new_count" ] + +cleanup diff --git a/tests/bugs/core/brick-mux-fd-cleanup.t b/tests/bugs/core/brick-mux-fd-cleanup.t new file mode 100644 index 00000000000..de11c177b8a --- /dev/null +++ b/tests/bugs/core/brick-mux-fd-cleanup.t @@ -0,0 +1,78 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +#This .t tests that the fds from client are closed on brick when gluster volume +#stop is executed in brick-mux setup. + +cleanup; +TEST glusterd +TEST pidof glusterd + +function keep_fd_open { +#This function has to be run as background job because opening the fd in +#foreground and running commands is leading to flush calls on these fds +#which is making it very difficult to create the race where fds will be left +#open even after the brick dies. + exec 5>$M1/a + exec 6>$M1/b + while [ -f $M0/a ]; do sleep 1; done +} + +function count_open_files { + local brick_pid="$1" + local pattern="$2" + ls -l /proc/$brick_pid/fd | grep -i "$pattern" | wc -l +} + +TEST $CLI volume set all cluster.brick-multiplex on +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume create $V1 replica 2 $H0:$B0/${V1}{2,3} +#Have same configuration on both bricks so that they are multiplexed +#Delay flush fop for a second +TEST $CLI volume heal $V0 disable +TEST $CLI volume heal $V1 disable +TEST $CLI volume set $V0 delay-gen posix +TEST $CLI volume set $V0 delay-gen.enable flush +TEST $CLI volume set $V0 delay-gen.delay-percentage 100 +TEST $CLI volume set $V0 delay-gen.delay-duration 1000000 +TEST $CLI volume set $V1 delay-gen posix +TEST $CLI volume set $V1 delay-gen.enable flush +TEST $CLI volume set $V1 delay-gen.delay-percentage 100 +TEST $CLI volume set $V1 delay-gen.delay-duration 1000000 + +TEST $CLI volume start $V0 +TEST $CLI volume start $V1 + +TEST $GFS -s $H0 --volfile-id=$V0 --direct-io-mode=enable $M0 +TEST $GFS -s $H0 --volfile-id=$V1 --direct-io-mode=enable $M1 + +TEST touch $M0/a +keep_fd_open & +TEST $CLI volume profile $V1 start +brick_pid=$(get_brick_pid $V1 $H0 $B0/${V1}2) +TEST count_open_files $brick_pid "$B0/${V1}2/a" +TEST count_open_files $brick_pid "$B0/${V1}2/b" +TEST count_open_files $brick_pid "$B0/${V1}3/a" +TEST count_open_files $brick_pid "$B0/${V1}3/b" + +#If any other flush fops are introduced into the system other than the one at +#cleanup it interferes with the race, so test for it +EXPECT "^0$" echo "$($CLI volume profile $V1 info incremental | grep -i flush | wc -l)" +#Stop the volume +TEST $CLI volume stop $V1 + +#Wait for cleanup resources or volume V1 +EXPECT_WITHIN $GRAPH_SWITCH_TIMEOUT "^0$" count_open_files $brick_pid "$B0/${V1}2/a" +EXPECT_WITHIN $GRAPH_SWITCH_TIMEOUT "^0$" count_open_files $brick_pid "$B0/${V1}2/b" +EXPECT_WITHIN $GRAPH_SWITCH_TIMEOUT "^0$" count_open_files $brick_pid "$B0/${V1}3/a" +EXPECT_WITHIN $GRAPH_SWITCH_TIMEOUT "^0$" count_open_files $brick_pid "$B0/${V1}3/b" + +TEST rm -f $M0/a #Exit keep_fd_open() +wait + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1 + +cleanup diff --git a/tests/bugs/core/bug-1110917.t b/tests/bugs/core/bug-1110917.t new file mode 100644 index 00000000000..c4b04fbf2c7 --- /dev/null +++ b/tests/bugs/core/bug-1110917.t @@ -0,0 +1,39 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2; +TEST $CLI volume start $V0; + +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +TEST $CLI volume set $V0 changelog on +TEST $CLI volume set $V0 changelog.fsync-interval 1 + +# perform I/O on the background +f=$(basename `mktemp -t ${0##*/}.XXXXXX`) +dd if=/dev/urandom of=$M0/$f count=100000 bs=4k & + +# this is the best we can do without inducing _error points_ in the code +# without the patch reconfigre() would hang... +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` + +TEST $CLI volume set $V0 changelog off +TEST $CLI volume set $V0 changelog on +TEST $CLI volume set $V0 changelog off +TEST $CLI volume set $V0 changelog on + +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` +TEST $CLI volume set $V0 changelog.rollover-time `expr $((RANDOM % 9)) + 1` + +# if there's a deadlock, this would hang +wait; + +cleanup; diff --git a/tests/bugs/core/bug-1111557.t b/tests/bugs/core/bug-1111557.t new file mode 100644 index 00000000000..4ed45761bce --- /dev/null +++ b/tests/bugs/core/bug-1111557.t @@ -0,0 +1,12 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}{0} +TEST $CLI volume set $V0 diagnostics.brick-log-buf-size 0 +TEST ! $CLI volume set $V0 diagnostics.brick-log-buf-size -0 +cleanup diff --git a/tests/bugs/core/bug-1117951.t b/tests/bugs/core/bug-1117951.t new file mode 100644 index 00000000000..b484fee2fe4 --- /dev/null +++ b/tests/bugs/core/bug-1117951.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/brick +EXPECT 'Created' volinfo_field $V0 'Status'; +TEST $CLI volume start $V0 + +# Running with a locale not using '.' as decimal separator should work +export LC_NUMERIC=sv_SE.utf8 +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +# As should a locale using '.' as a decimal separator +export LC_NUMERIC=C +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +cleanup diff --git a/tests/bugs/core/bug-1119582.t b/tests/bugs/core/bug-1119582.t new file mode 100644 index 00000000000..c30057c2b2c --- /dev/null +++ b/tests/bugs/core/bug-1119582.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../fileio.rc +. $(dirname $0)/../../nfs.rc + +cleanup; + +TEST glusterd; + +TEST pidof glusterd; + +TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1 + +TEST $CLI volume set $V0 features.uss disable; + +TEST killall glusterd; + +rm -f $GLUSTERD_WORKDIR/vols/$V0/snapd.info + +TEST glusterd + +cleanup ; diff --git a/tests/bugs/core/bug-1135514-allow-setxattr-with-null-value.t b/tests/bugs/core/bug-1135514-allow-setxattr-with-null-value.t new file mode 100644 index 00000000000..d26aa561321 --- /dev/null +++ b/tests/bugs/core/bug-1135514-allow-setxattr-with-null-value.t @@ -0,0 +1,18 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +#Test +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +TEST touch $M0/file +TEST setfattr -n user.attribute1 $M0/file +TEST getfattr -n user.attribute1 $M0/file +cleanup + diff --git a/tests/bugs/core/bug-1168803-snapd-option-validation-fix.t b/tests/bugs/core/bug-1168803-snapd-option-validation-fix.t new file mode 100755 index 00000000000..89b015d6374 --- /dev/null +++ b/tests/bugs/core/bug-1168803-snapd-option-validation-fix.t @@ -0,0 +1,30 @@ +#!/bin/bash + +## Test case for BZ-1168803 - snapd option validation should not fail if the +#snapd is not running + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; + +## create volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +TEST $CLI volume set $V0 features.uss enable + +## Now set another volume option, this should not fail +TEST $CLI volume set $V0 performance.io-cache off + +## start the volume +TEST $CLI volume start $V0 + +## Kill snapd daemon and then try to stop the volume which should not fail +kill $(ps aux | grep glusterfsd | grep snapd | awk '{print $2}') + +TEST $CLI volume stop $V0 + +cleanup; diff --git a/tests/bugs/core/bug-1402841.t-mt-dir-scan-race.t b/tests/bugs/core/bug-1402841.t-mt-dir-scan-race.t new file mode 100755 index 00000000000..a1b9a851bf7 --- /dev/null +++ b/tests/bugs/core/bug-1402841.t-mt-dir-scan-race.t @@ -0,0 +1,42 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +cleanup; + +FILE_COUNT=500 + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1} +TEST $CLI volume set $V0 self-heal-daemon off +TEST $CLI volume set $V0 cluster.shd-wait-qlength 100 +TEST $CLI volume start $V0 + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0; +for i in `seq 1 $FILE_COUNT`; do touch $M0/file$i; done +TEST kill_brick $V0 $H0 $B0/${V0}1 +for i in `seq 1 $FILE_COUNT`; do echo hello>$M0/file$i; chmod -x $M0/file$i; done +TEST $CLI volume start $V0 force +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1 + +EXPECT "$FILE_COUNT" get_pending_heal_count $V0 +TEST $CLI volume set $V0 self-heal-daemon on + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 + +TEST $CLI volume heal $V0 +TEST $CLI volume set $V0 self-heal-daemon off +EXPECT_NOT "^0$" get_pending_heal_count $V0 +TEST $CLI volume set $V0 self-heal-daemon on + +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0 +EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1 + +TEST $CLI volume heal $V0 +EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0 +TEST umount $M0 +cleanup; diff --git a/tests/bugs/core/bug-1421721-mpx-toggle.t b/tests/bugs/core/bug-1421721-mpx-toggle.t new file mode 100644 index 00000000000..231be5b81a0 --- /dev/null +++ b/tests/bugs/core/bug-1421721-mpx-toggle.t @@ -0,0 +1,25 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +write_a_file () { + echo $1 > $2 +} + +TEST glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}[0,1] + +TEST $CLI volume set all cluster.brick-multiplex on +TEST $CLI volume start $V0 + +TEST $GFS -s $H0 --volfile-id=$V0 $M0 +TEST write_a_file "hello" $M0/a_file + +TEST force_umount $M0 +TEST $CLI volume stop $V0 + +TEST $CLI volume set all cluster.brick-multiplex off +TEST $CLI volume start $V0 + +cleanup diff --git a/tests/bugs/core/bug-1432542-mpx-restart-crash.t b/tests/bugs/core/bug-1432542-mpx-restart-crash.t new file mode 100644 index 00000000000..2793d7008e1 --- /dev/null +++ b/tests/bugs/core/bug-1432542-mpx-restart-crash.t @@ -0,0 +1,116 @@ +#!/bin/bash + +SCRIPT_TIMEOUT=800 + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../traps.rc + +cleanup; + +NUM_VOLS=15 +MOUNT_BASE=$(dirname $M0) + +# GlusterD reports that bricks are started when in fact their attach requests +# might still need to be retried. That's a bit of a hack, but there's no +# feasible way to wait at that point (in attach_brick) and the rest of the +# code is unprepared to deal with transient errors so the whole "brick start" +# would fail. Meanwhile, glusterfsd can only handle attach requests at a +# rather slow rate. After GlusterD tries to start a couple of hundred bricks, +# glusterfsd can fall behind and we start getting mount failures. Arguably, +# those are spurious because we will eventually catch up. We're just not +# ready *yet*. More to the point, even if the errors aren't spurious that's +# not what we're testing right now. Therefore, we give glusterfsd a bit more +# breathing room for this test than we would otherwise. +MOUNT_TIMEOUT=15 + +get_brick_base () { + printf "%s/vol%02d" $B0 $1 +} + +get_mount_point () { + printf "%s/vol%02d" $MOUNT_BASE $1 +} + +function count_up_bricks { + vol=$1; + $CLI --xml volume status $vol | grep '<status>1' | wc -l +} + +create_volume () { + + local vol_name=$(printf "%s-vol%02d" $V0 $1) + + local brick_base=$(get_brick_base $1) + local cmd="$CLI volume create $vol_name replica 3" + local b + for b in $(seq 0 5); do + local this_brick=${brick_base}/brick$b + mkdir -p $this_brick + cmd="$cmd $H0:$this_brick" + done + TEST $cmd + TEST $CLI volume start $vol_name + # check for 6 bricks and 1 shd daemon to be up and running + EXPECT_WITHIN 120 7 count_up_bricks $vol_name + local mount_point=$(get_mount_point $1) + mkdir -p $mount_point + TEST $GFS -s $H0 --volfile-id=$vol_name $mount_point +} + +cleanup_func () { + local v + for v in $(seq 1 $NUM_VOLS); do + local mount_point=$(get_mount_point $v) + force_umount $mount_point + rm -rf $mount_point + local vol_name=$(printf "%s-vol%02d" $V0 $v) + $CLI volume stop $vol_name + $CLI volume delete $vol_name + rm -rf $(get_brick_base $1) & + done &> /dev/null + wait +} +push_trapfunc cleanup_func + +TEST glusterd +TEST $CLI volume set all cluster.brick-multiplex on + +# Our infrastructure can't handle an arithmetic expression here. The formula +# is (NUM_VOLS-1)*5 because it sees each TEST/EXPECT once but needs the other +# NUM_VOLS-1 and there are 5 such statements in each iteration. +TESTS_EXPECTED_IN_LOOP=84 +for i in $(seq 1 $NUM_VOLS); do + starttime="$(date +%s)"; + + create_volume $i + TEST dd if=/dev/zero of=$(get_mount_point $i)/a_file bs=4k count=1 + # Unmounting to reduce memory footprint on regression hosts + mnt_point=$(get_mount_point $i) + EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $mnt_point + endtime=$(expr $(date +%s) - $starttime) + + echo "Memory Used after $i volumes : $(pmap -x $(pgrep glusterfsd) | grep total)" + echo "Thread Count after $i volumes: $(ps -T -p $(pgrep glusterfsd) | wc -l)" + echo "Time taken : ${endtime} seconds" +done + +echo "==========" +echo "List of all the threads in the Brick process" +ps -T -p $(pgrep glusterfsd) +echo "==========" + +# Kill glusterd, and wait a bit for all traces to disappear. +TEST killall -9 glusterd +sleep 5 +TEST killall -9 glusterfsd +sleep 5 + +# Restart glusterd. This is where the brick daemon supposedly dumps core, +# though I (jdarcy) have yet to see that. Again, give it a while to settle, +# just to be sure. +TEST glusterd + +cleanup_func +trap - EXIT +cleanup diff --git a/tests/bugs/core/bug-1650403.t b/tests/bugs/core/bug-1650403.t new file mode 100644 index 00000000000..43d09bc8bd9 --- /dev/null +++ b/tests/bugs/core/bug-1650403.t @@ -0,0 +1,113 @@ +#!/bin/bash + +SCRIPT_TIMEOUT=500 + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../traps.rc + +cleanup; + +NUM_VOLS=5 +MOUNT_BASE=$(dirname $M0) + +# GlusterD reports that bricks are started when in fact their attach requests +# might still need to be retried. That's a bit of a hack, but there's no +# feasible way to wait at that point (in attach_brick) and the rest of the +# code is unprepared to deal with transient errors so the whole "brick start" +# would fail. Meanwhile, glusterfsd can only handle attach requests at a +# rather slow rate. After GlusterD tries to start a couple of hundred bricks, +# glusterfsd can fall behind and we start getting mount failures. Arguably, +# those are spurious because we will eventually catch up. We're just not +# ready *yet*. More to the point, even if the errors aren't spurious that's +# not what we're testing right now. Therefore, we give glusterfsd a bit more +# breathing room for this test than we would otherwise. +MOUNT_TIMEOUT=15 + +get_brick_base () { + printf "%s/vol%02d" $B0 $1 +} + +get_mount_point () { + printf "%s/vol%02d" $MOUNT_BASE $1 +} + +function count_up_bricks { + vol=$1; + $CLI --xml volume status $vol | grep '<status>1' | wc -l +} + +create_volume () { + + local vol_name=$(printf "%s-vol%02d" $V0 $1) + + local brick_base=$(get_brick_base $1) + local cmd="$CLI volume create $vol_name replica 3" + local b + for b in $(seq 0 5); do + local this_brick=${brick_base}/brick$b + mkdir -p $this_brick + cmd="$cmd $H0:$this_brick" + done + TEST $cmd + TEST $CLI volume start $vol_name + # check for 6 bricks and 1 shd daemon to be up and running + EXPECT_WITHIN 120 7 count_up_bricks $vol_name + local mount_point=$(get_mount_point $1) + mkdir -p $mount_point + TEST $GFS -s $H0 --volfile-id=$vol_name $mount_point +} + +cleanup_func () { + local v + for v in $(seq 1 $NUM_VOLS); do + local mount_point=$(get_mount_point $v) + force_umount $mount_point + rm -rf $mount_point + local vol_name=$(printf "%s-vol%02d" $V0 $v) + $CLI volume stop $vol_name + $CLI volume delete $vol_name + rm -rf $(get_brick_base $1) & + done &> /dev/null + wait +} +push_trapfunc cleanup_func + +TEST glusterd +TEST $CLI volume set all cluster.brick-multiplex on + +# Our infrastructure can't handle an arithmetic expression here. The formula +# is (NUM_VOLS-1)*5 because it sees each TEST/EXPECT once but needs the other +# NUM_VOLS-1 and there are 5 such statements in each iteration. +TESTS_EXPECTED_IN_LOOP=24 +for i in $(seq 1 $NUM_VOLS); do + create_volume $i + TEST dd if=/dev/zero of=$(get_mount_point $i)/a_file bs=4k count=1 + # Unmounting to reduce memory footprint on regression hosts + mnt_point=$(get_mount_point $i) + EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $mnt_point +done + +glustershd_pid=`ps auxwww | grep glustershd | grep -v grep | awk -F " " '{print $2}'` +TEST [ $glustershd_pid != 0 ] +start=`pmap -x $glustershd_pid | grep total | awk -F " " '{print $4}'` +echo "Memory consumption for glustershd process" +for i in $(seq 1 50); do + pmap -x $glustershd_pid | grep total + for j in $(seq 1 $NUM_VOLS); do + vol_name=$(printf "%s-vol%02d" $V0 $j) + gluster v set $vol_name cluster.self-heal-daemon off > /dev/null + gluster v set $vol_name cluster.self-heal-daemon on > /dev/null + done +done + +end=`pmap -x $glustershd_pid | grep total | awk -F " " '{print $4}'` +diff=$((end-start)) + +# If memory consumption is more than 10M it means some leak in reconfigure +# code path + +TEST [ $diff -lt 10000 ] + +trap - EXIT +cleanup diff --git a/tests/bugs/core/bug-1699025-brick-mux-detach-brick-fd-issue.t b/tests/bugs/core/bug-1699025-brick-mux-detach-brick-fd-issue.t new file mode 100644 index 00000000000..1acbaa8dc0b --- /dev/null +++ b/tests/bugs/core/bug-1699025-brick-mux-detach-brick-fd-issue.t @@ -0,0 +1,33 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../cluster.rc + +function count_brick_processes { + pgrep glusterfsd | wc -l +} + +cleanup + +#bug-1444596 - validating brick mux + +TEST glusterd +TEST $CLI volume create $V0 $H0:$B0/brick{0,1} +TEST $CLI volume create $V1 $H0:$B0/brick{2,3} + +TEST $CLI volume set all cluster.brick-multiplex on + +TEST $CLI volume start $V0 +TEST $CLI volume start $V1 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT 4 online_brick_count +EXPECT 1 count_brick_processes + +TEST $CLI volume stop $V1 +# At the time initialize brick daemon it always keeps open +# standard fd's (0, 1 , 2) so after stop 1 volume fd's should +# be open +nofds=$(ls -lrth /proc/`pgrep glusterfsd`/fd | grep dev/null | wc -l) +TEST [ $((nofds)) -eq 3 ] + +cleanup diff --git a/tests/bugs/core/bug-834465.c b/tests/bugs/core/bug-834465.c new file mode 100644 index 00000000000..33dd270b112 --- /dev/null +++ b/tests/bugs/core/bug-834465.c @@ -0,0 +1,60 @@ +#include <sys/file.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +int +main(int argc, char *argv[]) +{ + int fd = -1; + char *filename = NULL; + struct flock lock = { + 0, + }; + int i = 0; + int ret = -1; + + if (argc != 2) { + fprintf(stderr, "Usage: %s <filename> ", argv[0]); + goto out; + } + + filename = argv[1]; + + fd = open(filename, O_RDWR | O_CREAT, 0); + if (fd < 0) { + fprintf(stderr, "open (%s) failed (%s)\n", filename, strerror(errno)); + goto out; + } + + lock.l_type = F_WRLCK; + lock.l_whence = SEEK_SET; + lock.l_start = 1; + lock.l_len = 1; + + while (i < 100) { + lock.l_type = F_WRLCK; + ret = fcntl(fd, F_SETLK, &lock); + if (ret < 0) { + fprintf(stderr, "fcntl setlk failed (%s)\n", strerror(errno)); + goto out; + } + + lock.l_type = F_UNLCK; + ret = fcntl(fd, F_SETLK, &lock); + if (ret < 0) { + fprintf(stderr, "fcntl setlk failed (%s)\n", strerror(errno)); + goto out; + } + + i++; + } + + ret = 0; + +out: + return ret; +} diff --git a/tests/bugs/core/bug-834465.t b/tests/bugs/core/bug-834465.t new file mode 100755 index 00000000000..996248d4116 --- /dev/null +++ b/tests/bugs/core/bug-834465.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; + +TEST $CLI volume create $V0 $H0:$B0/brick1 $H0:$B0/brick2; +EXPECT 'Created' volinfo_field $V0 'Status'; + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +MOUNTDIR=$M0; + +#memory-accounting is enabled by default +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $MOUNTDIR; + +sdump1=$(generate_mount_statedump $V0); +nalloc1=0 +grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump1 +if [ $? -eq '0' ] +then + nalloc1=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump1 | grep -E "^num_allocs" | cut -d '=' -f2` +fi + +build_tester $(dirname $0)/bug-834465.c + +TEST $(dirname $0)/bug-834465 $M0/testfile + +sdump2=$(generate_mount_statedump $V0); +nalloc2=0 +grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump2 +if [ $? -eq '0' ] +then + nalloc2=`grep -A3 "fuse - usage-type gf_common_mt_fd_lk_ctx_node_t" $sdump2 | grep -E "^num_allocs" | cut -d '=' -f2` +fi + +TEST [ $nalloc1 -eq $nalloc2 ]; + +TEST rm -rf $MOUNTDIR/* +TEST rm -rf $(dirname $0)/bug-834465 +cleanup_mount_statedump $V0 + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $MOUNTDIR + +cleanup; diff --git a/tests/bugs/core/bug-845213.t b/tests/bugs/core/bug-845213.t new file mode 100644 index 00000000000..136e4126d14 --- /dev/null +++ b/tests/bugs/core/bug-845213.t @@ -0,0 +1,19 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +## Create and start a volume with aio enabled +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; +TEST $CLI volume set $V0 remote-dio enable; +TEST $CLI volume set $V0 network.remote-dio disable; + +cleanup; + diff --git a/tests/bugs/core/bug-903336.t b/tests/bugs/core/bug-903336.t new file mode 100644 index 00000000000..b52c1a4758e --- /dev/null +++ b/tests/bugs/core/bug-903336.t @@ -0,0 +1,13 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0} +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +TEST setfattr -n trusted.io-stats-dump -v /tmp $M0 +cleanup diff --git a/tests/bugs/core/bug-908146.t b/tests/bugs/core/bug-908146.t new file mode 100755 index 00000000000..327be6e54bc --- /dev/null +++ b/tests/bugs/core/bug-908146.t @@ -0,0 +1,30 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../fileio.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0}0 +TEST $CLI volume set $V0 performance.open-behind off +TEST $CLI volume set $V0 performance.flush-behind off +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --direct-io-mode=enable +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M1 --attribute-timeout=0 --entry-timeout=0 --direct-io-mode=enable + +TEST touch $M0/a + +exec 4>"$M0/a" +exec 5>"$M1/a" +EXPECT "2" get_fd_count $V0 $H0 $B0/${V0}0 a + +exec 4>&- +EXPECT "1" get_fd_count $V0 $H0 $B0/${V0}0 a + +exec 5>&- +EXPECT "0" get_fd_count $V0 $H0 $B0/${V0}0 a + +cleanup diff --git a/tests/bugs/core/bug-913544.t b/tests/bugs/core/bug-913544.t new file mode 100644 index 00000000000..af421722590 --- /dev/null +++ b/tests/bugs/core/bug-913544.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +#simulate a split-brain of a file and do truncate. This should not crash the mount point +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}0 $H0:$B0/${V0}1 +TEST $CLI volume set $V0 stat-prefetch off +TEST $CLI volume start $V0 +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +cd $M0 +TEST touch a +#simulate no-changelog data split-brain +echo "abc" > $B0/${V0}1/a +echo "abcd" > $B0/${V0}0/a +TEST truncate -s 0 a +TEST ls +cd + +cleanup diff --git a/tests/bugs/core/bug-924075.t b/tests/bugs/core/bug-924075.t new file mode 100755 index 00000000000..61ce0f18286 --- /dev/null +++ b/tests/bugs/core/bug-924075.t @@ -0,0 +1,23 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +#FIXME: there is another patch which moves the following function into +#include.rc +function process_leak_count () +{ + local pid=$1; + return $(ls -lh /proc/$pid/fd | grep "(deleted)" | wc -l) +} + +TEST glusterd; +TEST $CLI volume create $V0 $H0:$B0/${V0}1; +TEST $CLI volume start $V0; +TEST glusterfs -s $H0 --volfile-id $V0 $M0; +mount_pid=$(get_mount_process_pid $V0); +TEST process_leak_count $mount_pid; + +cleanup; diff --git a/tests/bugs/core/bug-927616.t b/tests/bugs/core/bug-927616.t new file mode 100755 index 00000000000..18257131ac7 --- /dev/null +++ b/tests/bugs/core/bug-927616.t @@ -0,0 +1,65 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../nfs.rc + +#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST + +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2}; +TEST $CLI volume set $V0 performance.open-behind off; +TEST $CLI volume set $V0 nfs.disable false +TEST $CLI volume start $V0 + +## Mount FUSE with caching disabled +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; + +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available; +TEST mount_nfs $H0:/$V0 $N0 nolock; + +TEST mkdir $M0/dir; + +mkdir $M0/other; +cp /etc/passwd $M0/; +cp $M0/passwd $M0/file; +chmod 600 $M0/file; + +chown -R nfsnobody:nfsnobody $M0/dir; + +TEST $CLI volume set $V0 server.root-squash on; + +sleep 1; + +# tests should fail. +touch $M0/foo 2>/dev/null; +TEST [ $? -ne 0 ] +touch $N0/foo 2>/dev/null; +TEST [ $? -ne 0 ] +mkdir $M0/new 2>/dev/null; +TEST [ $? -ne 0 ] +mkdir $N0/new 2>/dev/null; +TEST [ $? -ne 0 ] + +TEST $CLI volume set $V0 server.root-squash off; + +sleep 1; + +# tests should pass. +touch $M0/foo 2>/dev/null; +TEST [ $? -eq 0 ] +touch $N0/bar 2>/dev/null; +TEST [ $? -eq 0 ] +mkdir $M0/new 2>/dev/null; +TEST [ $? -eq 0 ] +mkdir $N0/old 2>/dev/null; +TEST [ $? -eq 0 ] + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" umount_nfs $N0 + +TEST $CLI volume stop $V0; +TEST $CLI volume delete $V0; + +cleanup; diff --git a/tests/bugs/core/bug-949242.t b/tests/bugs/core/bug-949242.t new file mode 100644 index 00000000000..5e916cbdbe6 --- /dev/null +++ b/tests/bugs/core/bug-949242.t @@ -0,0 +1,55 @@ +#!/bin/bash +# +# Bug 949242 - Test basic fallocate functionality. +# +# Run several commands to verify basic fallocate functionality. We verify that +# fallocate creates and allocates blocks to a file. We also verify that the keep +# size option does not modify the file size. +### + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../fallocate.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4} +TEST $CLI volume start $V0 + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +# check for fallocate support before continuing the test +require_fallocate -l 1m -n $M0/file && rm -f $M0/file + +# fallocate a file and verify blocks are allocated +TEST fallocate -l 1m $M0/file +blksz=`stat -c %b $M0/file` +nblks=`stat -c %B $M0/file` +TEST [ $(($blksz * $nblks)) -eq 1048576 ] + +TEST unlink $M0/file + +# truncate a file to a fixed size, fallocate and verify that the size does not +# change +TEST truncate -s 1M $M0/file +TEST fallocate -l 2m -n $M0/file +blksz=`stat -c %b $M0/file` +nblks=`stat -c %B $M0/file` +sz=`stat -c %s $M0/file` +TEST [ $sz -eq 1048576 ] +# Note that gluster currently incorporates a hack to limit the number of blocks +# reported as allocated to the file by the file size. We have allocated beyond the +# file size here. Just check for non-zero allocation to avoid setting a land mine +# for if/when that behavior might change. +TEST [ ! $(($blksz * $nblks)) -eq 0 ] + +TEST unlink $M0/file + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup; diff --git a/tests/bugs/core/bug-986429.t b/tests/bugs/core/bug-986429.t new file mode 100644 index 00000000000..e512301775f --- /dev/null +++ b/tests/bugs/core/bug-986429.t @@ -0,0 +1,19 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +## This tests failover achieved by providing multiple +## servers from the trusted pool for fetching volume +## specification + +cleanup; + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/$V0 +TEST $CLI volume start $V0 +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s non-existent -s $H0 --volfile-id=/$V0 $M0 + +cleanup; diff --git a/tests/bugs/core/io-stats-1322825.t b/tests/bugs/core/io-stats-1322825.t new file mode 100755 index 00000000000..53f2d040daa --- /dev/null +++ b/tests/bugs/core/io-stats-1322825.t @@ -0,0 +1,67 @@ +#!/bin/bash + +# Test details: +# This is to test that the io-stat-dump xattr is not set on the brick, +# against the path that is used to trigger the stats dump. +# Additionally it also tests if as many io-stat dumps are generated as there +# are io-stat xlators in the graphs, which is 2 by default + +. $(dirname $0)/../../include.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +# Covering replication and distribution in the test +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1..4} +TEST $CLI volume start $V0 +TEST $GFS -s $H0 --volfile-id $V0 $M0 + +# Generate some activity for the stats to produce something useful +TEST $CLI volume profile $V0 start +TEST mkdir $M0/dir1 + +# Generate the stat dump across the io-stat instances +TEST setfattr -n trusted.io-stats-dump -v io-stats-1322825 $M0 + +# Check if $M0 is clean w.r.t xattr information +# TODO: if there are better ways to check we really get no attr error, please +# correct the following. +getfattr -n trusted.io-stats-dump $B0/${V0}1 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret +getfattr -n trusted.io-stats-dump $B0/${V0}2 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret +getfattr -n trusted.io-stats-dump $B0/${V0}3 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret +getfattr -n trusted.io-stats-dump $B0/${V0}4 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret + +# Check if we have 5 io-stat files in /tmp +EXPECT 5 ls -1 /var/run/gluster/io-stats-1322825* +# Cleanup the 5 generated files +rm -f /var/run/gluster/io-stats-1322825* + +# Rinse and repeat above for a directory +TEST setfattr -n trusted.io-stats-dump -v io-stats-1322825 $M0/dir1 +getfattr -n trusted.io-stats-dump $B0/${V0}1/dir1 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret +getfattr -n trusted.io-stats-dump $B0/${V0}2/dir1 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret +getfattr -n trusted.io-stats-dump $B0/${V0}3/dir1 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret +getfattr -n trusted.io-stats-dump $B0/${V0}4/dir1 2>&1 | grep -qi "no such attribute" +ret=$(echo $?) +EXPECT 0 echo $ret + +EXPECT 5 ls -1 /var/run/gluster/io-stats-1322825* +rm -f /var/run/gluster/io-stats-1322825* + +cleanup; diff --git a/tests/bugs/core/log-bug-1362520.t b/tests/bugs/core/log-bug-1362520.t new file mode 100755 index 00000000000..cde854c3349 --- /dev/null +++ b/tests/bugs/core/log-bug-1362520.t @@ -0,0 +1,43 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +#. $(dirname $0)/../../volume.rc + +cleanup; + +#Basic checks +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info + +#Create a distributed volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1}; +TEST $CLI volume start $V0 + +# Mount FUSE without selinux: +TEST glusterfs -s $H0 --volfile-id $V0 $@ $M0 + +#Get the client log file +log_wd=$(gluster --print-logdir) +log_id=${M0:1} # Remove initial slash +log_id=${log_id//\//-} # Replace remaining slashes with dashes +log_file=$log_wd/$log_id.log + +#Set the client xlator log-level to TRACE and check if the TRACE logs get +#printed +TEST setfattr -n trusted.glusterfs.$V0-client-0.set-log-level -v TRACE $M0 +TEST ! stat $M0/xyz +grep -q " T \[rpc-clnt\.c" $log_file +res=$? +EXPECT '0' echo $res + +#Set the client xlator log-level to INFO and make sure the TRACE logs do +#not get printed +echo > $log_file +TEST setfattr -n trusted.glusterfs.$V0-client-0.set-log-level -v INFO $M0 +TEST ! stat $M0/xyz +grep -q " T \[rpc-clnt\.c" $log_file +res=$? +EXPECT_NOT '0' echo $res + +cleanup; |
