summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2014-07-08 08:59:42 +0200
committerNiels de Vos <ndevos@redhat.com>2014-07-10 00:15:18 -0700
commita4369c456de4304ebdb252bc2783d634a56f8301 (patch)
treef3dbd1684951d0781373730a1dde28409171e086 /tests
parent3d7b19cd1ecd53f0808b07df7c4ac801fd48f3c3 (diff)
nfs: prevent assertion error with MOUNT over UDP
The MOUNT service over UDP runs in a separate thread. This thread does not have the correct *THIS xlator set. *THIS points to the global (base) xlator structure, but GF_CALLOC() requires it to be the NFS-xlator so that assertions can get validated correctly. This is solved by passing the NFS-xlator to the pthread function, and setting the *THIS pointer explicitly in the new thread. It seems that on occasion (needs further investigation) MOUNT over UDP does not unregister itself. There can also be issues when the kernel NLM implementation has been registered at portmap/rpcbind, so adding some unregister procedures in the cleanup of the test-cases. Cherry picked from commit ec74ceedaa41047b88d270c00eeb071b73e19664: > Change-Id: I3be5a420fc800bbcc14198d0b6faf4cf2c7300b1 > BUG: 1116503 > Signed-off-by: Niels de Vos <ndevos@redhat.com> > Reviewed-on: http://review.gluster.org/8241 > Reviewed-by: Santosh Pradhan <spradhan@redhat.com> > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Vijay Bellur <vbellur@redhat.com> Change-Id: I3be5a420fc800bbcc14198d0b6faf4cf2c7300b1 BUG: 1116997 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/8258 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Santosh Pradhan <spradhan@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/bug-1116503.t24
-rw-r--r--tests/include.rc16
-rw-r--r--tests/nfs.rc9
-rw-r--r--tests/volume.rc5
4 files changed, 52 insertions, 2 deletions
diff --git a/tests/bugs/bug-1116503.t b/tests/bugs/bug-1116503.t
new file mode 100644
index 00000000000..639c75bad93
--- /dev/null
+++ b/tests/bugs/bug-1116503.t
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# Verify that mounting NFS over UDP (MOUNT service only) works.
+#
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../nfs.rc
+
+
+cleanup;
+TEST glusterd
+TEST pidof glusterd
+
+TEST $CLI volume create $V0 $H0:$B0/$V0
+TEST $CLI volume set $V0 nfs.mount-udp on
+
+TEST $CLI volume start $V0
+EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
+
+TEST mount -t nfs -o soft,intr,vers=3,nolock,mountproto=udp,proto=tcp $H0:/$V0 $N0;
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $N0
+
+cleanup;
diff --git a/tests/include.rc b/tests/include.rc
index a1713880d84..5d209d61075 100644
--- a/tests/include.rc
+++ b/tests/include.rc
@@ -7,10 +7,13 @@ B0=${B0:=/d/backends}; # top level of brick directories
H0=${H0:=`hostname --fqdn`}; # hostname
DEBUG=${DEBUG:=0} # turn on debugging?
statedumpdir=`gluster --print-statedumpdir`; # Default directory for statedump
-CHILD_UP_TIMEOUT=60
CLI="gluster --mode=script";
+CHILD_UP_TIMEOUT=60
+NFS_EXPORT_TIMEOUT=20
+UMOUNT_TIMEOUT=5
PROCESS_UP_TIMEOUT=20
+
mkdir -p $B0;
mkdir -p $M0 $M1;
mkdir -p $N0 $N1;
@@ -225,6 +228,17 @@ function cleanup()
umount $m
done
+ # unregister nfs and related services from portmapper/rpcbind
+ ## nfs
+ rpcinfo -d 100003 3
+ ## mountd
+ rpcinfo -d 100005 1
+ rpcinfo -d 100005 3
+ ## nlockmgr
+ rpcinfo -d 100021 1
+ rpcinfo -d 100021 4
+ ## nfs_acl
+ rpcinfo -d 100227 3
LOOPDEVICES=`losetup -a | grep "$B0/" | awk '{print $1}' | tr -d :`
for l in $LOOPDEVICES;
diff --git a/tests/nfs.rc b/tests/nfs.rc
index f3abee84280..e35b6852284 100644
--- a/tests/nfs.rc
+++ b/tests/nfs.rc
@@ -18,4 +18,11 @@ function is_nfs_export_available ()
echo "$exp"
}
-
+function mount_nfs ()
+{
+ local e=$1
+ local m=$2
+ local opt=$3
+ if [ ! -z "$opt" ]; then opt=",$opt"; fi
+ mount -t nfs -o soft,intr,vers=3"$opt" $e $m
+}
diff --git a/tests/volume.rc b/tests/volume.rc
index e3346bc8004..1c58597c661 100644
--- a/tests/volume.rc
+++ b/tests/volume.rc
@@ -253,6 +253,11 @@ function dht_get_layout {
getfattr -d -e hex -n $my_xa $1 2> /dev/null | grep "$my_xa=" | cut -d= -f2
}
+function force_umount {
+ umount -f $1
+ if [ $? -eq 0 ]; then echo "Y"; else echo "N"; fi
+}
+
function afr_get_specific_changelog_xattr ()
{
local path=$1