From 6a1559ff8057e5c2a992a990cfb630932e6928d2 Mon Sep 17 00:00:00 2001 From: Bipin Kunal Date: Fri, 10 Jun 2016 17:03:35 +0530 Subject: nfs: build exportlist with multiple groupnodes The EXPORT procedure of the MOUNT protocol does not correctly create structures for the 'groupnodes' in the reply. Each 'groupnode' should be a single entry in the 'nfs.rpc-auth-allow' volume option. Because the value is handled as a single string, the encoding of the groupnode->gr_name fails when the value of the volume option is longer than 255 characters. In the error case, encoding the EXPORTS reply fails, and the waiting 'showmount' command will not receive a reply and times out. Splitting the allowed entries and creating a groupnode for each one prevents the too long ->gr_name. This is following the structures for the EXPORTS reply in the MOUNT protocol more correctly as well. Note that the contents of ->gr_name is expected to be server dependent. This is backport of below mainline fix - http://review.gluster.org/#/c/14667/ Change-Id: Ibbabad581cc9aa00feb80fbbc851a1b10b28383d BUG: 1343290 Signed-off-by: Niels de Vos Signed-off-by: Bipin Kunal Reviewed-on: http://review.gluster.org/14698 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- tests/bugs/nfs/showmount-many-clients.t | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/bugs/nfs/showmount-many-clients.t (limited to 'tests/bugs') diff --git a/tests/bugs/nfs/showmount-many-clients.t b/tests/bugs/nfs/showmount-many-clients.t new file mode 100644 index 00000000000..f1b6859d528 --- /dev/null +++ b/tests/bugs/nfs/showmount-many-clients.t @@ -0,0 +1,41 @@ +#!/bin/bash +# +# The nfs.rpc-auth-allow volume option is used to generate the list of clients +# that are displayed as able to mount the export. The "group" in the export +# should be a list of all clients, identified by "name". In previous versions, +# the "name" was the copied string from nfs.rpc-auth-allow. This is not +# correct, as the volume option should be parsed and split into different +# groups. +# +# When the single string is passed, this testcase fails when the +# nfs.rpc-auth-allow volume option is longer than 256 characters. By splitting +# the groups into their own structures, this testcase passes. +# + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../nfs.rc +. $(dirname $0)/../../volume.rc + +cleanup + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/brick1 +EXPECT 'Created' volinfo_field $V0 'Status' +TEST $CLI volume set $V0 nfs.disable false + +CLIENTS=$(echo 127.0.0.{1..128} | tr ' ' ,) +TEST $CLI volume set $V0 nfs.rpc-auth-allow ${CLIENTS} +TEST $CLI volume set $V0 nfs.rpc-auth-reject all + +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status' + +# glusterfs/nfs needs some time to start up in the background +EXPECT_WITHIN $NFS_EXPORT_TIMEOUT 1 is_nfs_export_available + +# showmount should not timeout (no reply is sent on error) +TEST showmount -e $H0 + +cleanup -- cgit