diff options
Diffstat (limited to 'tests/bugs/fuse')
| -rw-r--r-- | tests/bugs/fuse/bug-1030208.t | 35 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-1126048.c | 43 | ||||
| -rwxr-xr-x | tests/bugs/fuse/bug-1126048.t | 30 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-1283103.t | 59 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-1309462.t | 50 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-1336818.t | 52 | ||||
| -rwxr-xr-x | tests/bugs/fuse/bug-858215.t | 79 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-858488-min-free-disk.t | 108 | ||||
| -rwxr-xr-x | tests/bugs/fuse/bug-924726.t | 45 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-963678.t | 57 | ||||
| -rwxr-xr-x | tests/bugs/fuse/bug-983477.t | 53 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-985074.t | 54 | ||||
| -rwxr-xr-x | tests/bugs/fuse/many-groups-for-acl.t | 123 | ||||
| -rwxr-xr-x | tests/bugs/fuse/setup.sh | 20 | ||||
| -rwxr-xr-x | tests/bugs/fuse/teardown.sh | 5 |
15 files changed, 813 insertions, 0 deletions
diff --git a/tests/bugs/fuse/bug-1030208.t b/tests/bugs/fuse/bug-1030208.t new file mode 100644 index 00000000000..526283cf101 --- /dev/null +++ b/tests/bugs/fuse/bug-1030208.t @@ -0,0 +1,35 @@ +#!/bin/bash + +#Test case: Hardlink test + +. $(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..2}; +TEST $CLI volume start $V0 + +# Mount FUSE +TEST glusterfs -s $H0 --volfile-id $V0 $M0 + +#Create a file and perform fop on a DIR +TEST touch $M0/foo +TEST ls $M0/ + +#Create hardlink +TEST ln $M0/foo $M0/bar + + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0; +TEST ! $CLI volume info $V0; + +cleanup; diff --git a/tests/bugs/fuse/bug-1126048.c b/tests/bugs/fuse/bug-1126048.c new file mode 100644 index 00000000000..19165ecf6f7 --- /dev/null +++ b/tests/bugs/fuse/bug-1126048.c @@ -0,0 +1,43 @@ +#include <stdio.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> + +/* + * This function opens a file and to trigger migration failure, unlinks the + * file and performs graph switch (cmd passed in argv). If everything goes fine, + * fsync should fail without crashing the mount process. + */ +int +main(int argc, char **argv) +{ + int ret = 0; + int fd = 0; + char *cmd = argv[1]; + struct stat stbuf = { + 0, + }; + + printf("cmd is: %s\n", cmd); + fd = open("a.txt", O_CREAT | O_RDWR, 0644); + if (fd < 0) + printf("open failed: %s\n", strerror(errno)); + + ret = unlink("a.txt"); + if (ret < 0) + printf("unlink failed: %s\n", strerror(errno)); + if (write(fd, "abc", 3) < 0) + printf("Not able to print %s\n", strerror(errno)); + system(cmd); + sleep(1); /* No way to confirm graph switch so sleep 1 */ + ret = fstat(fd, &stbuf); + if (ret < 0) + printf("fstat failed %\n", strerror(errno)); + ret = fsync(fd); + if (ret < 0) + printf("Not able to fsync %s\n", strerror(errno)); + return 0; +} diff --git a/tests/bugs/fuse/bug-1126048.t b/tests/bugs/fuse/bug-1126048.t new file mode 100755 index 00000000000..5e2ed293cd3 --- /dev/null +++ b/tests/bugs/fuse/bug-1126048.t @@ -0,0 +1,30 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + +function grep_for_ebadf { + $M0/bug-1126048 "gluster --mode=script --wignore volume add-brick $V0 $H0:$B0/brick2" | grep -i "Bad file descriptor" +} +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/brick1; +EXPECT 'Created' volinfo_field $V0 'Status'; + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +TEST glusterfs -s $H0 --volfile-id=$V0 $M0 --direct-io-mode=yes + +build_tester $(dirname $0)/bug-1126048.c + +TEST cp $(dirname $0)/bug-1126048 $M0 +cd $M0 +TEST grep_for_ebadf +TEST ls -l $M0 +cd - +TEST rm -f $(dirname $0)/bug-1126048 +cleanup; diff --git a/tests/bugs/fuse/bug-1283103.t b/tests/bugs/fuse/bug-1283103.t new file mode 100644 index 00000000000..56612534cb9 --- /dev/null +++ b/tests/bugs/fuse/bug-1283103.t @@ -0,0 +1,59 @@ +#!/bin/bash + +# +# https://bugzilla.redhat.com/show_bug.cgi?id=1283103 +# +# Test that it is possible to set and get security.* +# xattrs other thatn security.selinux irrespective of +# whether the mount was done with --selinux. This is +# for example important for Samba to be able to store +# the Windows-level acls in the security.NTACL xattr +# when the acl_xattr vfs module is used. +# + +. $(dirname $0)/../../include.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..2}; +TEST $CLI volume start $V0 + +# Mount FUSE without selinux: +TEST glusterfs -s $H0 --volfile-id $V0 $M0 + +TESTFILE="$M0/testfile" +TEST touch ${TESTFILE} + +TEST echo "setfattr -n security.foobar -v value ${TESTFILE}" +TEST setfattr -n security.foobar -v value ${TESTFILE} +TEST getfattr -n security.foobar ${TESTFILE} +TEST setfattr -x security.foobar ${TESTFILE} + +# can not currently test the security.selinux xattrs +# since the kernel intercepts them. +# see https://bugzilla.redhat.com/show_bug.cgi?id=1272868 +#TEST ! getfattr -n security.selinux ${TESTFILE} +#TEST ! setfattr -n security.selinux -v value ${TESTFILE} + +TEST umount $M0 + +# Mount FUSE with selinux: +TEST glusterfs -s $H0 --volfile-id $V0 --selinux $M0 + +TEST setfattr -n security.foobar -v value ${TESTFILE} +TEST getfattr -n security.foobar ${TESTFILE} +TEST setfattr -x security.foobar ${TESTFILE} + +# can not currently test the security.selinux xattrs +# since the kernel intercepts them. +# see https://bugzilla.redhat.com/show_bug.cgi?id=1272868 +#TEST setfattr -n security.selinux -v value ${TESTFILE} +#TEST getfattr -n security.selinux ${TESTFILE} + +cleanup; diff --git a/tests/bugs/fuse/bug-1309462.t b/tests/bugs/fuse/bug-1309462.t new file mode 100644 index 00000000000..975d72d82ed --- /dev/null +++ b/tests/bugs/fuse/bug-1309462.t @@ -0,0 +1,50 @@ +#!/bin/bash +# +# https://bugzilla.redhat.com/show_bug.cgi?id=1309462 +# Test the new fuse mount option --capability. +# Set/get xattr on security.capability should be sent +# down from fuse, only if --selinux or --capability option +# is used for mounting. + +. $(dirname $0)/../../include.rc + +cleanup; + +#Basic checks +TEST glusterd +TEST pidof glusterd + +#Create a distributed volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1..2}; +TEST $CLI volume start $V0 + +# Mount FUSE without selinux: +TEST glusterfs -s $H0 --volfile-id $V0 $M0 + +TESTFILE="$M0/testfile" +TEST touch ${TESTFILE} + +TEST ! setfattr -n security.capability -v value ${TESTFILE} +TEST ! getfattr -n security.capability ${TESTFILE} + +TEST umount $M0 + +# Mount FUSE with selinux: +TEST glusterfs -s $H0 --volfile-id $V0 --selinux $M0 + +TEST setfattr -n security.capability -v value ${TESTFILE} +TEST getfattr -n security.capability ${TESTFILE} +TEST setfattr -x security.capability ${TESTFILE} + +TEST umount $M0 + +# Mount FUSE with capability: +TEST glusterfs -s $H0 --volfile-id $V0 --capability $M0 + +TEST setfattr -n security.capability -v value ${TESTFILE} +TEST getfattr -n security.capability ${TESTFILE} +TEST setfattr -x security.capability ${TESTFILE} + +TEST umount $M0 +#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=1581735 +#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=1581735
\ No newline at end of file diff --git a/tests/bugs/fuse/bug-1336818.t b/tests/bugs/fuse/bug-1336818.t new file mode 100644 index 00000000000..53286521742 --- /dev/null +++ b/tests/bugs/fuse/bug-1336818.t @@ -0,0 +1,52 @@ +#!/bin/bash + +#Test case: OOM score adjust + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +# Prepare +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/brick1; +EXPECT 'Created' volinfo_field $V0 'Status'; + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +# Basic check +TEST glusterfs -s $H0 --volfile-id $V0 $M0 +TEST umount $M0 + +# Check valid value (< 0) +TEST glusterfs --oom-score-adj=-1000 -s $H0 --volfile-id $V0 $M0 +TEST umount $M0 + +# Check valid value (> 0) +TEST glusterfs --oom-score-adj=1000 -s $H0 --volfile-id $V0 $M0 +TEST umount $M0 + +# Check valid value (= 0) +TEST glusterfs --oom-score-adj=0 -s $H0 --volfile-id $V0 $M0 +TEST umount $M0 + +# Check invalid value (no value given) +TEST ! glusterfs --oom-score-adj -s $H0 --volfile-id $V0 $M0 + +# Check invalid value (< OOM_SCORE_ADJ_MIN) +TEST ! glusterfs --oom-score-adj=-1001 -s $H0 --volfile-id $V0 $M0 + +# Check invalid value (> OOM_SCORE_ADJ_MAX) +TEST ! glusterfs --oom-score-adj=1001 -s $H0 --volfile-id $V0 $M0 + +# Check invalid value (float) +TEST ! glusterfs --oom-score-adj=12.34 -s $H0 --volfile-id $V0 $M0 + +# Check invalid value (non-integer string) +TEST ! glusterfs --oom-score-adj=qwerty -s $H0 --volfile-id $V0 $M0 + +cleanup; diff --git a/tests/bugs/fuse/bug-858215.t b/tests/bugs/fuse/bug-858215.t new file mode 100755 index 00000000000..95999f6ad24 --- /dev/null +++ b/tests/bugs/fuse/bug-858215.t @@ -0,0 +1,79 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; + + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{1,2,3,4,5,6}; +TEST $CLI volume set $V0 nfs.disable off + +function volinfo_field() +{ + local vol=$1; + local field=$2; + + $CLI volume info $vol | grep "^$field: " | sed 's/.*: //'; +} + + +## Verify volume is is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + + +## Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +## Mount FUSE with caching disabled +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 --event-history=on -s $H0 --volfile-id $V0 $M0; + +## Test for checking whether the fops have been saved in the event-history +TEST ! stat $M0/newfile; +TEST touch $M0/newfile; +TEST stat $M0/newfile; +TEST rm $M0/newfile; + +nfs_pid=$(cat $GLUSTERD_PIDFILEDIR/nfs/nfs.pid || echo -1); +glustershd_pid=`ps auxwww | grep glustershd | grep -v grep | awk -F " " '{print $2}'` +TEST [ $glustershd_pid != 0 ]; +pids=$(pidof glusterfs); +for i in $pids +do + if [ $i -ne $nfs_pid ] && [ $i -ne $glustershd_pid ]; then + mount_pid=$i; + break; + fi +done + +dump_dir='/tmp/gerrit_glusterfs' +cat >$statedumpdir/glusterdump.options <<EOF +all=yes +path=$dump_dir +EOF + +TEST mkdir -p $dump_dir; +TEST kill -USR1 $mount_pid; +sleep 2; +for file_name in $(ls $dump_dir) +do + TEST grep -q "xlator.mount.fuse.history" $dump_dir/$file_name; +done + +## Finish up +TEST $CLI volume stop $V0; +EXPECT 'Stopped' volinfo_field $V0 'Status'; + +TEST $CLI volume delete $V0; +TEST ! $CLI volume info $V0; + +TEST rm -rf $dump_dir; +TEST rm $statedumpdir/glusterdump.options; + +cleanup; diff --git a/tests/bugs/fuse/bug-858488-min-free-disk.t b/tests/bugs/fuse/bug-858488-min-free-disk.t new file mode 100644 index 00000000000..635dc04d1e6 --- /dev/null +++ b/tests/bugs/fuse/bug-858488-min-free-disk.t @@ -0,0 +1,108 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +## Lets create partitions for bricks +TEST truncate -s 100M $B0/brick1 +TEST truncate -s 200M $B0/brick2 +TEST LO1=`SETUP_LOOP $B0/brick1` +TEST MKFS_LOOP $LO1 +TEST LO2=`SETUP_LOOP $B0/brick2` +TEST MKFS_LOOP $LO2 +TEST mkdir -p $B0/${V0}1 $B0/${V0}2 +TEST MOUNT_LOOP $LO1 $B0/${V0}1 +TEST MOUNT_LOOP $LO2 $B0/${V0}2 + +## Lets create volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; + +## Verify volume is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +## Start volume and verify +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST glusterfs -s $H0 --volfile-id=$V0 --acl $M0 +## Real test starts here +## ---------------------------------------------------------------------------- + +MINFREEDISKVALUE=90% + +## Set min free disk to MINFREEDISKVALUE percent +TEST $CLI volume set $V0 cluster.min-free-disk $MINFREEDISKVALUE + +## We need to have file name to brick map based on hash. +## We will use this info in test case 0. +i=1 +CONTINUE=2 +BRICK1FILE=0 +BRICK2FILE=0 +while [[ $CONTINUE -ne 0 ]] +do + dd if=/dev/zero of=$M0/file$i.data bs=1024 count=1024 1>/dev/null 2>&1 + + if [[ -e $B0/${V0}1/file$i.data && $BRICK1FILE = "0" ]] + then + BRICK1FILE=file$i.data + CONTINUE=$(( $CONTINUE - 1 )) + fi + + if [[ -e $B0/${V0}2/file$i.data && $BRICK2FILE = "0" ]] + then + BRICK2FILE=file$i.data + CONTINUE=$(( $CONTINUE - 1 )) + fi + + rm $M0/file$i.data + let i++ +done + + +## Bring free space on one of the bricks to less than minfree value by +## creating one big file. +dd if=/dev/zero of=$M0/fillonebrick.data bs=1024 count=25600 1>/dev/null 2>&1 + +#Lets find out where it was created +if [ -f $B0/${V0}1/fillonebrick.data ] +then + FILETOCREATE=$BRICK1FILE + OTHERBRICK=$B0/${V0}2 +else + FILETOCREATE=$BRICK2FILE + OTHERBRICK=$B0/${V0}1 +fi + +##--------------------------------TEST CASE 0----------------------------------- +## If we try to create a file which should go into full brick as per hash, it +## should go into the other brick instead. + +## Before that let us create files just to make gluster refresh the stat +## Using touch so it should not change the disk usage stats +for k in {1..20}; +do + touch $M0/dummyfile$k +done + +dd if=/dev/zero of=$M0/$FILETOCREATE bs=1024 count=2048 1>/dev/null 2>&1 +TEST [ -e $OTHERBRICK/$FILETOCREATE ] +## Done testing, lets clean up +TEST rm -rf $M0/* + +## Finish up +TEST $CLI volume stop $V0; +EXPECT 'Stopped' volinfo_field $V0 'Status'; +$CLI volume delete $V0; + +UMOUNT_LOOP ${B0}/${V0}{1,2} +rm -f ${B0}/brick{1,2} + +cleanup; diff --git a/tests/bugs/fuse/bug-924726.t b/tests/bugs/fuse/bug-924726.t new file mode 100755 index 00000000000..2d3c7680798 --- /dev/null +++ b/tests/bugs/fuse/bug-924726.t @@ -0,0 +1,45 @@ +#!/bin/bash + +TESTS_EXPECTED_IN_LOOP=10 + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function get_socket_count() { + netstat -nap | grep $1 | wc -l +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/$V0 +EXPECT 'Created' volinfo_field $V0 'Status'; + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +TEST glusterfs -s $H0 --volfile-id $V0 $M0; + +TEST ls $M0 + +GLFS_MNT_PID=`ps ax | grep "glusterfs -s $H0 \-\-volfile\-id $V0 $M0" | sed -e "s/^ *\([0-9]*\).*/\1/g"` + +SOCKETS_BEFORE_SWITCH=`netstat -nap | grep $GLFS_MNT_PID | grep ESTABLISHED | wc -l` + +for i in $(seq 1 5); do + TEST_IN_LOOP $CLI volume set $V0 performance.write-behind off; + sleep 1; + TEST_IN_LOOP $CLI volume set $V0 performance.write-behind on; + sleep 1; +done + +SOCKETS_AFTER_SWITCH=`netstat -nap | grep $GLFS_MNT_PID | grep ESTABLISHED | wc -l` + +# currently active graph is not cleaned up till some operation on +# mount-point. Hence there is one extra graph. +TEST [ $SOCKETS_AFTER_SWITCH = `expr $SOCKETS_BEFORE_SWITCH + 1` ] + +cleanup; diff --git a/tests/bugs/fuse/bug-963678.t b/tests/bugs/fuse/bug-963678.t new file mode 100644 index 00000000000..006181f26e1 --- /dev/null +++ b/tests/bugs/fuse/bug-963678.t @@ -0,0 +1,57 @@ +#!/bin/bash +# +# Bug 963678 - Test discard functionality +# +# Test that basic discard (hole punch) functionality works via the fallocate +# command line tool. Hole punch deallocates a region of a file, creating a hole +# and a zero-filled data region. We verify that hole punch works, frees blocks +# and that subsequent reads do not read stale data (caches are invalidated). +# +# NOTE: fuse fallocate is known to be broken with regard to cache invalidation +# up to 3.9.0 kernels. Therefore, FOPEN_KEEP_CACHE is not used in this +# test (opens will invalidate the fuse cache). +### + +. $(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} +TEST $CLI volume start $V0 + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 + +# check for fallocate and hole punch support +require_fallocate -l 1m $M0/file +require_fallocate -p -l 512k $M0/file && rm -f $M0/file + +# allocate some blocks, punch a hole and verify block allocation +TEST fallocate -l 1m $M0/file +blksz=`stat -c %B $M0/file` +nblks=`stat -c %b $M0/file` +TEST [ $(($blksz * $nblks)) -ge 1048576 ] +TEST fallocate -p -o 512k -l 128k $M0/file + +nblks=`stat -c %b $M0/file` +# allow some room for xattr blocks +TEST [ $(($blksz * $nblks)) -lt $((917504 + 16384)) ] +TEST unlink $M0/file + +# write some data, punch a hole and verify the file content changes +TEST dd if=/dev/urandom of=$M0/file bs=1024k count=1 +TEST cp $M0/file $M0/file.copy.pre +TEST fallocate -p -o 512k -l 128k $M0/file +TEST cp $M0/file $M0/file.copy.post +TEST ! cmp $M0/file.copy.pre $M0/file.copy.post +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/fuse/bug-983477.t b/tests/bugs/fuse/bug-983477.t new file mode 100755 index 00000000000..41ddd9e55a9 --- /dev/null +++ b/tests/bugs/fuse/bug-983477.t @@ -0,0 +1,53 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +#This script checks if use-readdirp option works as accepted in mount options + +function get_use_readdirp_value { + local vol=$1 + local statedump=$(generate_mount_statedump $vol) + sleep 1 + local val=$(grep "use_readdirp=" $statedump | cut -f2 -d'=' | tail -1) + rm -f $statedump + echo $val +} +cleanup; + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create $V0 $H0:$B0/${V0} +TEST $CLI volume start $V0 +#If readdirp is enabled statedump should reflect it +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --use-readdirp=yes +TEST cd $M0 +EXPECT "1" get_use_readdirp_value $V0 +TEST cd - +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +#If readdirp is enabled statedump should reflect it +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --use-readdirp=no +TEST cd $M0 +EXPECT "0" get_use_readdirp_value $V0 +TEST cd - +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +#Since args are optional on this argument just specifying "--use-readdirp" should also turn it `on` not `off` +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --use-readdirp +TEST cd $M0 +EXPECT "1" get_use_readdirp_value $V0 +TEST cd - +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +#By default it is enabled. +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 +TEST cd $M0 +EXPECT "1" get_use_readdirp_value $V0 +TEST cd - +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +#Invalid values for use-readdirp should not be accepted +TEST ! glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0 --use-readdirp=please-fail + +cleanup diff --git a/tests/bugs/fuse/bug-985074.t b/tests/bugs/fuse/bug-985074.t new file mode 100644 index 00000000000..ffa6df54144 --- /dev/null +++ b/tests/bugs/fuse/bug-985074.t @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Bug 985074 - Verify stale inode/dentry mappings are cleaned out. +# +# This test verifies that an inode/dentry mapping for a file removed via a +# separate mount point is cleaned up appropriately. We create a file and hard +# link from client 1. Next we remove the link via client 2. Finally, from client +# 1 we attempt to rename the original filename to the name of the just removed +# hard link. +# +# If the inode is not unlinked properly, the removed directory entry can resolve +# to an inode (on the client that never saw the rm) that ends up passed down +# through the lookup call. If md-cache holds valid metadata on the inode (due to +# a large timeout value or recent lookup on the valid name), it is tricked into +# returning a successful lookup that should have returned ENOENT. This manifests +# as an error from the mv command in the following test sequence because file +# and file.link resolve to the same file: +# +# # mv /mnt/glusterfs/0/file /mnt/glusterfs/0/file.link +# mv: `/mnt/glusterfs/0/file' and `/mnt/glusterfs/0/file.link' are the same file +# +### + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +TEST glusterd + +TEST $CLI volume create $V0 $H0:$B0/$V0 +TEST $CLI volume start $V0 +TEST $CLI volume set $V0 performance.stat-prefetch off + +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M0 --entry-timeout=0 --attribute-timeout=0 +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 $M1 --entry-timeout=0 --attribute-timeout=0 + +TEST touch $M0/file +TEST ln $M0/file $M0/file.link +TEST ls -ali $M0 $M1 +TEST rm -f $M1/file.link +TEST ls -ali $M0 $M1 + +TEST mv $M0/file $M0/file.link +TEST stat $M0/file.link +TEST ! stat $M0/file + +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1 +EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 + +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0 + +cleanup; diff --git a/tests/bugs/fuse/many-groups-for-acl.t b/tests/bugs/fuse/many-groups-for-acl.t new file mode 100755 index 00000000000..a51b1bc7267 --- /dev/null +++ b/tests/bugs/fuse/many-groups-for-acl.t @@ -0,0 +1,123 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../nfs.rc + +cleanup + +# prepare the users and groups +NEW_USER=bug1246275 +NEW_UID=1246275 +NEW_GID=1246275 +LAST_GID=1246403 +NEW_GIDS=${NEW_GID} + +# OS-specific overrides +case $OSTYPE in +NetBSD|Darwin) + # no ACLs, and only NGROUPS_MAX=16 secondary groups are supported + SKIP_TESTS + exit 0 + ;; +FreeBSD) + # NGROUPS_MAX=1023 (FreeBSD>=8.0), we can afford 200 groups + ;; +Linux) + # NGROUPS_MAX=65536, we can afford 200 groups + ;; +*) + ;; +esac + +# create a user that belongs to many groups +for GID in $(seq -f '%6.0f' ${NEW_GID} ${LAST_GID}) +do + groupadd -o -g ${GID} ${NEW_USER}-${GID} + NEW_GIDS="${NEW_GIDS},${NEW_USER}-${GID}" +done +TEST useradd -o -M -u ${NEW_UID} -g ${NEW_GID} -G ${NEW_USER}-${NEW_GIDS} ${NEW_USER} + +# Linux < 3.8 exports only first 32 gids of pid to userspace +kernel_exports_few_gids=0 +if [ "$OSTYPE" = Linux ] && \ + su -m ${NEW_USER} -c "grep ^Groups: /proc/self/status | wc -w | xargs -I@ expr @ - 1 '<' $LAST_GID - $NEW_GID + 1" > /dev/null; then + kernel_exports_few_gids=1 +fi + +# preparation done, start the tests + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume create ${V0} ${H0}:${B0}/${V0}1 +TEST $CLI volume set $V0 nfs.disable off +# disable manage-gids on the server-side for now, gets enabled later +TEST $CLI volume set ${V0} server.manage-gids off +TEST $CLI volume start ${V0} + +# This is just a synchronization hack to make sure the bricks are +# up before going on. +EXPECT_WITHIN ${NFS_EXPORT_TIMEOUT} "1" is_nfs_export_available + +# mount the volume with POSIX ACL support, without --resolve-gids +TEST glusterfs --acl --volfile-id=/${V0} --volfile-server=${H0} ${M0} + +# create some directories for testing +TEST mkdir ${M0}/first-32-gids-1 +TEST setfacl -m g:${NEW_UID}:rwx ${M0}/first-32-gids-1 +TEST mkdir ${M0}/first-32-gids-2 +TEST setfacl -m g:$[NEW_UID+16]:rwx ${M0}/first-32-gids-2 +TEST mkdir ${M0}/gid-64 +TEST setfacl -m g:$[NEW_UID+64]:rwx ${M0}/gid-64 +TEST mkdir ${M0}/gid-120 +TEST setfacl -m g:$[NEW_UID+120]:rwx ${M0}/gid-120 + +su -m ${NEW_USER} -c "touch ${M0}/first-32-gids-1/success > /dev/null" +TEST [ $? -eq 0 ] + +su -m ${NEW_USER} -c "touch ${M0}/first-32-gids-2/success > /dev/null" +TEST [ $? -eq 0 ] + +su -m ${NEW_USER} -c "touch ${M0}/gid-64/success--if-all-gids-exported > /dev/null" +TEST [ $? -eq $kernel_exports_few_gids ] + +su -m ${NEW_USER} -c "touch ${M0}/gid-120/failure > /dev/null" +TEST [ $? -ne 0 ] + +# unmount and remount with --resolve-gids +EXPECT_WITHIN ${UMOUNT_TIMEOUT} "Y" force_umount ${M0} +TEST glusterfs --acl --resolve-gids --volfile-id=/${V0} --volfile-server=${H0} ${M0} + +su -m ${NEW_USER} -c "touch ${M0}/gid-64/success > /dev/null" +TEST [ $? -eq 0 ] + +su -m ${NEW_USER} -c "touch ${M0}/gid-120/failure > /dev/null" +TEST [ $? -ne 0 ] + +# enable server-side resolving of the groups +# stopping and starting is not really needed, but it prevents races +TEST $CLI volume stop ${V0} +TEST $CLI volume set ${V0} server.manage-gids on +TEST $CLI volume start ${V0} +EXPECT_WITHIN ${NFS_EXPORT_TIMEOUT} "1" is_nfs_export_available + +# unmount and remount to prevent more race conditions on test systems +EXPECT_WITHIN ${UMOUNT_TIMEOUT} "Y" force_umount ${M0} +TEST glusterfs --acl --resolve-gids --volfile-id=/${V0} --volfile-server=${H0} ${M0} + +su -m ${NEW_USER} -c "touch ${M0}/gid-120/success > /dev/null" +TEST [ $? -eq 0 ] + +# cleanup +userdel --force ${NEW_USER} +for GID in $(seq -f '%6.0f' ${NEW_GID} ${LAST_GID}) +do + groupdel ${NEW_USER}-${GID} +done + +EXPECT_WITHIN ${UMOUNT_TIMEOUT} "Y" force_umount ${M0} + +TEST ${CLI} volume stop ${V0} +TEST ${CLI} volume delete ${V0} + +cleanup diff --git a/tests/bugs/fuse/setup.sh b/tests/bugs/fuse/setup.sh new file mode 100755 index 00000000000..d44d8dba027 --- /dev/null +++ b/tests/bugs/fuse/setup.sh @@ -0,0 +1,20 @@ +#!/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..2}; +TEST $CLI volume start $V0 + +# Mount FUSE without selinux: +TEST glusterfs -s $H0 --volfile-id $V0 $@ $M0 + +echo "Gluster started and volume '$V0' mounted under '$M0'" diff --git a/tests/bugs/fuse/teardown.sh b/tests/bugs/fuse/teardown.sh new file mode 100755 index 00000000000..5d57974e1f9 --- /dev/null +++ b/tests/bugs/fuse/teardown.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc + +cleanup; |
