diff options
Diffstat (limited to 'tests/bugs/fuse')
| -rw-r--r-- | tests/bugs/fuse/bug-1126048.c | 44 | ||||
| -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 | 11 | ||||
| -rwxr-xr-x | tests/bugs/fuse/bug-924726.t | 2 | ||||
| -rw-r--r-- | tests/bugs/fuse/bug-985074.t | 5 | ||||
| -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 |
10 files changed, 343 insertions, 28 deletions
diff --git a/tests/bugs/fuse/bug-1126048.c b/tests/bugs/fuse/bug-1126048.c index 5b9afafef0f..19165ecf6f7 100644 --- a/tests/bugs/fuse/bug-1126048.c +++ b/tests/bugs/fuse/bug-1126048.c @@ -12,26 +12,32 @@ * fsync should fail without crashing the mount process. */ int -main (int argc, char **argv) +main(int argc, char **argv) { - int ret = 0; - int fd = 0; - char *cmd = argv[1]; + 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); - if (fd < 0) - printf ("open failed: %s\n", strerror(errno)); + 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 = fsync(fd); - if (ret < 0) - printf ("Not able to fsync %s\n", strerror (errno)); - return 0; + 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-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 index b33b8d4971b..95999f6ad24 100755 --- a/tests/bugs/fuse/bug-858215.t +++ b/tests/bugs/fuse/bug-858215.t @@ -10,7 +10,8 @@ TEST glusterd; TEST pidof glusterd; TEST $CLI volume info; -TEST $CLI volume create $V0 replica 2 stripe 2 $H0:$B0/${V0}{1,2,3,4,5,6,7,8}; +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() { @@ -31,7 +32,7 @@ TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; ## Mount FUSE with caching disabled -TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; +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; @@ -39,9 +40,9 @@ TEST touch $M0/newfile; TEST stat $M0/newfile; TEST rm $M0/newfile; -nfs_pid=$(cat $GLUSTERD_WORKDIR/nfs/run/nfs.pid); -glustershd_pid=$(cat $GLUSTERD_WORKDIR/glustershd/run/glustershd.pid); - +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 diff --git a/tests/bugs/fuse/bug-924726.t b/tests/bugs/fuse/bug-924726.t index 58bf2c8a083..2d3c7680798 100755 --- a/tests/bugs/fuse/bug-924726.t +++ b/tests/bugs/fuse/bug-924726.t @@ -25,7 +25,7 @@ TEST glusterfs -s $H0 --volfile-id $V0 $M0; TEST ls $M0 -GLFS_MNT_PID=`ps ax | grep -i $M0 | grep glusterfs | grep -v grep | sed -e "s/^ *\([0-9]*\).*/\1/g"` +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` diff --git a/tests/bugs/fuse/bug-985074.t b/tests/bugs/fuse/bug-985074.t index d10fd9f8b41..ffa6df54144 100644 --- a/tests/bugs/fuse/bug-985074.t +++ b/tests/bugs/fuse/bug-985074.t @@ -30,7 +30,7 @@ TEST glusterd TEST $CLI volume create $V0 $H0:$B0/$V0 TEST $CLI volume start $V0 -TEST $CLI volume set $V0 md-cache-timeout 3 +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 @@ -40,8 +40,7 @@ TEST ln $M0/file $M0/file.link TEST ls -ali $M0 $M1 TEST rm -f $M1/file.link TEST ls -ali $M0 $M1 -# expire the md-cache timeout -sleep 3 + TEST mv $M0/file $M0/file.link TEST stat $M0/file.link TEST ! stat $M0/file 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; |
