From 9d9876ccd6751dbbee37f19235325f6e3417570c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Nov 05 2019 20:54:08 +0000 Subject: import nfs-utils-2.3.3-26.el8 --- diff --git a/SOURCES/nfs-utils-2.3.3-covscan-resource-leaks.patch b/SOURCES/nfs-utils-2.3.3-covscan-resource-leaks.patch new file mode 100644 index 0000000..c6b84ba --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-covscan-resource-leaks.patch @@ -0,0 +1,468 @@ +diff -up nfs-utils-2.3.3/configure.ac.orig nfs-utils-2.3.3/configure.ac +--- nfs-utils-2.3.3/configure.ac.orig 2019-09-18 10:57:14.190810677 -0400 ++++ nfs-utils-2.3.3/configure.ac 2019-09-18 10:57:56.715567641 -0400 +@@ -561,6 +561,7 @@ my_am_cflags="\ + -Werror=parentheses \ + -Werror=aggregate-return \ + -Werror=unused-result \ ++ -Wno-cast-function-type \ + -fno-strict-aliasing \ + " + +diff -up nfs-utils-2.3.3/support/junction/path.c.orig nfs-utils-2.3.3/support/junction/path.c +--- nfs-utils-2.3.3/support/junction/path.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/junction/path.c 2019-09-18 10:57:56.715567641 -0400 +@@ -163,8 +163,10 @@ nsdb_count_components(const char *pathna + break; + next = strchrnul(component, '/'); + tmp = (size_t)(next - component); +- if (tmp > 255) ++ if (tmp > 255) { ++ free(start); + return false; ++ } + length += XDR_UINT_BYTES + (nsdb_quadlen(tmp) << 2); + count++; + +@@ -328,11 +330,13 @@ nsdb_posix_to_path_array(const char *pat + length = (size_t)(next - component); + if (length > 255) { + nsdb_free_string_array(result); ++ free(normalized); + return FEDFS_ERR_SVRFAULT; + } + + result[i] = strndup(component, length); + if (result[i] == NULL) { ++ free(normalized); + nsdb_free_string_array(result); + return FEDFS_ERR_SVRFAULT; + } +diff -up nfs-utils-2.3.3/support/nfs/exports.c.orig nfs-utils-2.3.3/support/nfs/exports.c +--- nfs-utils-2.3.3/support/nfs/exports.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfs/exports.c 2019-09-18 10:57:56.715567641 -0400 +@@ -714,6 +714,7 @@ parsesquash(char *list, int **idp, int * + } + if (id0 == -1 || id1 == -1) { + syntaxerr("uid/gid -1 not permitted"); ++ xfree(id); + return -1; + } + if ((len % 8) == 0) +@@ -724,6 +725,7 @@ parsesquash(char *list, int **idp, int * + break; + if (*cp != ',') { + syntaxerr("bad uid/gid list"); ++ xfree(id); + return -1; + } + cp++; +diff -up nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c.orig nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c +--- nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfsidmap/libnfsidmap.c 2019-09-18 10:57:56.716567635 -0400 +@@ -406,8 +406,10 @@ int nfs4_init_name_mapping(char *conffil + nfs4_methods = conf_get_list("Translation", "Method"); + if (nfs4_methods) { + IDMAP_LOG(1, ("libnfsidmap: processing 'Method' list")); +- if (load_plugins(nfs4_methods, &nfs4_plugins) == -1) ++ if (load_plugins(nfs4_methods, &nfs4_plugins) == -1) { ++ conf_free_list(nfs4_methods); + return -ENOENT; ++ } + } else { + struct conf_list list; + struct conf_list_node node; +@@ -475,11 +477,15 @@ out: + if (ret) { + if (nfs4_plugins) + unload_plugins(nfs4_plugins); +- if (gss_plugins) ++ if (gss_plugins) { + unload_plugins(gss_plugins); ++ } + nfs4_plugins = gss_plugins = NULL; + } + ++ if (gss_methods) ++ conf_free_list(gss_methods); ++ + return ret ? -ENOENT: 0; + } + +diff -up nfs-utils-2.3.3/support/nfsidmap/static.c.orig nfs-utils-2.3.3/support/nfsidmap/static.c +--- nfs-utils-2.3.3/support/nfsidmap/static.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfsidmap/static.c 2019-09-18 10:57:56.716567635 -0400 +@@ -347,6 +347,7 @@ static int static_init(void) { + warnx("static_init: calloc (1, %lu) failed", + (unsigned long)sizeof *unode); + free(pw); ++ conf_free_list(princ_list); + return -ENOMEM; + } + unode->uid = pw->pw_uid; +@@ -355,6 +356,9 @@ static int static_init(void) { + unode->localname = conf_get_str("Static", cln->field); + if (!unode->localname) { + free(pw); ++ free(unode->principal); ++ free(unode); ++ conf_free_list(princ_list); + return -ENOENT; + } + +@@ -379,6 +383,7 @@ static int static_init(void) { + warnx("static_init: calloc (1, %lu) failed", + (unsigned long)sizeof *gnode); + free(gr); ++ conf_free_list(princ_list); + return -ENOMEM; + } + gnode->gid = gr->gr_gid; +@@ -387,6 +392,9 @@ static int static_init(void) { + gnode->localgroup = conf_get_str("Static", cln->field); + if (!gnode->localgroup) { + free(gr); ++ free(gnode->principal); ++ free(gnode); ++ conf_free_list(princ_list); + return -ENOENT; + } + +@@ -394,6 +402,8 @@ static int static_init(void) { + + LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link); + } ++ ++ conf_free_list(princ_list); + return 0; + } + +diff -up nfs-utils-2.3.3/support/nfs/mydaemon.c.orig nfs-utils-2.3.3/support/nfs/mydaemon.c +--- nfs-utils-2.3.3/support/nfs/mydaemon.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfs/mydaemon.c 2019-09-18 10:57:56.716567635 -0400 +@@ -123,6 +123,7 @@ daemon_init(bool fg) + dup2(tempfd, 0); + dup2(tempfd, 1); + dup2(tempfd, 2); ++ close(tempfd); + closelog(); + dup2(pipefds[1], 3); + pipefds[1] = 3; +diff -up nfs-utils-2.3.3/support/nfs/rpcmisc.c.orig nfs-utils-2.3.3/support/nfs/rpcmisc.c +--- nfs-utils-2.3.3/support/nfs/rpcmisc.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfs/rpcmisc.c 2019-09-18 10:57:56.716567635 -0400 +@@ -102,6 +102,7 @@ makesock(int port, int proto) + if (bind(sock, (struct sockaddr *) &sin, sizeof(sin)) == -1) { + xlog(L_FATAL, "Could not bind name to socket: %s", + strerror(errno)); ++ close(sock); + return -1; + } + +diff -up nfs-utils-2.3.3/support/nfs/svc_socket.c.orig nfs-utils-2.3.3/support/nfs/svc_socket.c +--- nfs-utils-2.3.3/support/nfs/svc_socket.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfs/svc_socket.c 2019-09-18 10:57:56.717567629 -0400 +@@ -134,6 +134,7 @@ svc_socket (u_long number, int type, int + if (ret < 0) + { + xlog(L_ERROR, "svc_socket: socket reuse problem: %m"); ++ (void) __close(sock); + return ret; + } + } +diff -up nfs-utils-2.3.3/support/nfs/xcommon.c.orig nfs-utils-2.3.3/support/nfs/xcommon.c +--- nfs-utils-2.3.3/support/nfs/xcommon.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfs/xcommon.c 2019-09-18 10:57:56.717567629 -0400 +@@ -53,14 +53,17 @@ char * + xstrconcat3 (const char *s, const char *t, const char *u) { + char *res; + +- if (!s) s = ""; ++ int dofree = 1; ++ ++ if (!s) s = "", dofree=0; + if (!t) t = ""; + if (!u) u = ""; + res = xmalloc(strlen(s) + strlen(t) + strlen(u) + 1); + strcpy(res, s); + strcat(res, t); + strcat(res, u); +- free((void *) s); ++ if (dofree) ++ free((void *) s); + return res; + } + +@@ -69,7 +72,9 @@ char * + xstrconcat4 (const char *s, const char *t, const char *u, const char *v) { + char *res; + +- if (!s) s = ""; ++ int dofree = 1; ++ ++ if (!s) s = "", dofree=0; + if (!t) t = ""; + if (!u) u = ""; + if (!v) v = ""; +@@ -78,7 +83,8 @@ xstrconcat4 (const char *s, const char * + strcat(res, t); + strcat(res, u); + strcat(res, v); +- free((void *) s); ++ if (dofree) ++ free((void *) s); + return res; + } + +diff -up nfs-utils-2.3.3/support/nfs/xlog.c.orig nfs-utils-2.3.3/support/nfs/xlog.c +--- nfs-utils-2.3.3/support/nfs/xlog.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfs/xlog.c 2019-09-18 10:57:56.717567629 -0400 +@@ -135,10 +135,14 @@ xlog_from_conffile(char *service) + struct conf_list_node *n; + + kinds = conf_get_list(service, "debug"); +- if (!kinds || !kinds->cnt) ++ if (!kinds || !kinds->cnt) { ++ free(kinds); + return; ++ } + TAILQ_FOREACH(n, &(kinds->fields), link) + xlog_sconfig(n->field, 1); ++ ++ conf_free_list(kinds); + } + + int +diff -up nfs-utils-2.3.3/support/nsm/file.c.orig nfs-utils-2.3.3/support/nsm/file.c +--- nfs-utils-2.3.3/support/nsm/file.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nsm/file.c 2019-09-18 10:57:56.717567629 -0400 +@@ -533,6 +533,7 @@ nsm_update_kernel_state(const int state) + len = snprintf(buf, sizeof(buf), "%d", state); + if (error_check(len, sizeof(buf))) { + xlog_warn("Failed to form NSM state number string"); ++ close(fd); + return; + } + +diff -up nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c.orig nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c +--- nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/systemd/rpc-pipefs-generator.c 2019-09-18 10:57:56.717567629 -0400 +@@ -69,12 +69,16 @@ int generate_target(char *pipefs_path, c + return 1; + + ret = generate_mount_unit(pipefs_path, pipefs_unit, dirname); +- if (ret) ++ if (ret) { ++ free(pipefs_unit); + return ret; ++ } + + path = malloc(strlen(dirname) + 1 + sizeof(filebase)); +- if (!path) ++ if (!path) { ++ free(pipefs_unit); + return 2; ++ } + sprintf(path, "%s", dirname); + mkdir(path, 0755); + strcat(path, filebase); +@@ -82,6 +86,7 @@ int generate_target(char *pipefs_path, c + if (!f) + { + free(path); ++ free(pipefs_unit); + return 1; + } + +@@ -90,6 +95,7 @@ int generate_target(char *pipefs_path, c + fprintf(f, "After=%s\n", pipefs_unit); + fclose(f); + free(path); ++ free(pipefs_unit); + + return 0; + } +diff -up nfs-utils-2.3.3/utils/blkmapd/device-discovery.c.orig nfs-utils-2.3.3/utils/blkmapd/device-discovery.c +--- nfs-utils-2.3.3/utils/blkmapd/device-discovery.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/utils/blkmapd/device-discovery.c 2019-09-18 10:58:54.444237714 -0400 +@@ -186,8 +186,11 @@ static void bl_add_disk(char *filepath) + } + } + +- if (disk && diskpath) ++ if (disk && diskpath) { ++ if (serial) ++ free(serial); + return; ++ } + + /* add path */ + path = malloc(sizeof(struct bl_disk_path)); +@@ -223,6 +226,8 @@ static void bl_add_disk(char *filepath) + disk->size = size; + disk->valid_path = path; + } ++ if (serial) ++ free(serial); + } + return; + +@@ -232,6 +237,9 @@ static void bl_add_disk(char *filepath) + free(path->full_path); + free(path); + } ++ if (serial) ++ free(serial); ++ + return; + } + +@@ -375,7 +383,12 @@ static void bl_rpcpipe_cb(void) + if (event->mask & IN_CREATE) { + BL_LOG_WARNING("nfs pipe dir created\n"); + bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd); ++ if (bl_pipe_fd >= 0) ++ close(bl_pipe_fd); + bl_pipe_fd = open(bl_pipe_file, O_RDWR); ++ if (bl_pipe_fd < 0) ++ BL_LOG_ERR("open %s failed: %s\n", ++ event->name, strerror(errno)); + } else if (event->mask & IN_DELETE) { + BL_LOG_WARNING("nfs pipe dir deleted\n"); + inotify_rm_watch(bl_watch_fd, nfs_pipedir_wfd); +@@ -388,6 +401,8 @@ static void bl_rpcpipe_cb(void) + continue; + if (event->mask & IN_CREATE) { + BL_LOG_WARNING("blocklayout pipe file created\n"); ++ if (bl_pipe_fd >= 0) ++ close(bl_pipe_fd); + bl_pipe_fd = open(bl_pipe_file, O_RDWR); + if (bl_pipe_fd < 0) + BL_LOG_ERR("open %s failed: %s\n", +diff -up nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig nfs-utils-2.3.3/utils/gssd/krb5_util.c +--- nfs-utils-2.3.3/utils/gssd/krb5_util.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/utils/gssd/krb5_util.c 2019-09-18 10:57:56.718567624 -0400 +@@ -698,6 +698,8 @@ gssd_search_krb5_keytab(krb5_context con + "we failed to unparse principal name: %s\n", + k5err); + k5_free_kt_entry(context, kte); ++ free(k5err); ++ k5err = NULL; + continue; + } + printerr(4, "Processing keytab entry for principal '%s'\n", +@@ -899,6 +901,8 @@ find_keytab_entry(krb5_context context, + k5err = gssd_k5_err_msg(context, code); + printerr(1, "%s while building principal for '%s'\n", + k5err, spn); ++ free(k5err); ++ k5err = NULL; + continue; + } + code = krb5_kt_get_entry(context, kt, princ, 0, 0, kte); +@@ -1168,7 +1172,8 @@ gssd_get_krb5_machine_cred_list(char *** + *list = l; + retval = 0; + goto out; +- } ++ } else ++ free((void *)l); + out: + return retval; + } +@@ -1216,6 +1221,8 @@ gssd_destroy_krb5_machine_creds(void) + printerr(0, "WARNING: %s while resolving credential " + "cache '%s' for destruction\n", k5err, + ple->ccname); ++ free(k5err); ++ k5err = NULL; + continue; + } + +diff -up nfs-utils-2.3.3/utils/mount/configfile.c.orig nfs-utils-2.3.3/utils/mount/configfile.c +--- nfs-utils-2.3.3/utils/mount/configfile.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/utils/mount/configfile.c 2019-09-18 10:57:56.718567624 -0400 +@@ -404,7 +404,7 @@ char *conf_get_mntopts(char *spec, char + + /* list_size + optlen + ',' + '\0' */ + config_opts = calloc(1, (list_size+optlen+2)); +- if (server == NULL) { ++ if (config_opts == NULL) { + xlog_warn("conf_get_mountops: Unable calloc memory for config_opts"); + free_all(); + return mount_opts; +diff -up nfs-utils-2.3.3/utils/mountd/cache.c.orig nfs-utils-2.3.3/utils/mountd/cache.c +--- nfs-utils-2.3.3/utils/mountd/cache.c.orig 2019-09-18 10:57:14.190810677 -0400 ++++ nfs-utils-2.3.3/utils/mountd/cache.c 2019-09-18 10:57:56.718567624 -0400 +@@ -1240,7 +1240,7 @@ static struct exportent *lookup_junction + goto out; + } + status = nfs_get_basic_junction(pathname, &locations); +- switch (status) { ++ if (status) { + xlog(L_WARNING, "Dangling junction %s: %s", + pathname, strerror(status)); + goto out; +@@ -1248,10 +1248,11 @@ static struct exportent *lookup_junction + + parent = lookup_parent_export(dom, pathname, ai); + if (parent == NULL) +- goto out; ++ goto free_locations; + + exp = locations_to_export(locations, pathname, parent); + ++free_locations: + nfs_free_locations(locations->ns_list); + free(locations); + +diff -up nfs-utils-2.3.3/utils/mountd/fsloc.c.orig nfs-utils-2.3.3/utils/mountd/fsloc.c +--- nfs-utils-2.3.3/utils/mountd/fsloc.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/utils/mountd/fsloc.c 2019-09-18 10:57:56.719567618 -0400 +@@ -102,6 +102,7 @@ static struct servers *parse_list(char * + cp = strchr(list[i], '@'); + if ((!cp) || list[i][0] != '/') { + xlog(L_WARNING, "invalid entry '%s'", list[i]); ++ free(mp); + continue; /* XXX Need better error handling */ + } + res->h_mp[i] = mp; +diff -up nfs-utils-2.3.3/utils/mount/nfsmount.c.orig nfs-utils-2.3.3/utils/mount/nfsmount.c +--- nfs-utils-2.3.3/utils/mount/nfsmount.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/utils/mount/nfsmount.c 2019-09-18 10:57:56.730567555 -0400 +@@ -452,6 +452,7 @@ parse_options(char *old_opts, struct nfs + nfs_error(_("%s: Bad nfs mount parameter: %s\n"), progname, opt); + out_bad: + free(tmp_opts); ++ free(mounthost); + return 0; + } + +diff -up nfs-utils-2.3.3/utils/mount/stropts.c.orig nfs-utils-2.3.3/utils/mount/stropts.c +--- nfs-utils-2.3.3/utils/mount/stropts.c.orig 2019-09-18 10:57:14.183810717 -0400 ++++ nfs-utils-2.3.3/utils/mount/stropts.c 2019-09-18 10:57:56.730567555 -0400 +@@ -982,8 +982,11 @@ static int nfs_try_mount(struct nfsmount + } + + if (!nfs_append_addr_option(address->ai_addr, +- address->ai_addrlen, mi->options)) ++ address->ai_addrlen, mi->options)) { ++ freeaddrinfo(address); ++ errno = ENOMEM; + return 0; ++ } + mi->address = address; + } + +diff -up nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c.orig nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c +--- nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/utils/nfsdcltrack/sqlite.c 2019-09-18 10:57:56.731567549 -0400 +@@ -215,6 +215,8 @@ sqlite_maindb_init_v2(void) + &err); + if (ret != SQLITE_OK) { + xlog(L_ERROR, "Unable to begin transaction: %s", err); ++ if (err) ++ sqlite3_free(err); + return ret; + } + diff --git a/SOURCES/nfs-utils-2.3.3-gating-tests.patch b/SOURCES/nfs-utils-2.3.3-gating-tests.patch deleted file mode 100644 index 8f70d8f..0000000 --- a/SOURCES/nfs-utils-2.3.3-gating-tests.patch +++ /dev/null @@ -1,3813 +0,0 @@ -From 26dfa0f7846f14aa86048d504913d3a3be7196d0 Mon Sep 17 00:00:00 2001 -From: Bruno Goncalves -Date: Jan 17 2019 10:02:50 +0000 -Subject: [PATCH 1/6] Add CI tests - - -Related: rhbz#1653927 - ---- - -diff --git a/tests/export-mount-local/PURPOSE b/tests/export-mount-local/PURPOSE -new file mode 100644 -index 0000000..556df42 ---- /dev/null -+++ b/tests/export-mount-local/PURPOSE -@@ -0,0 +1 @@ -+# nothing -diff --git a/tests/export-mount-local/_env b/tests/export-mount-local/_env -new file mode 100644 -index 0000000..90b8e90 ---- /dev/null -+++ b/tests/export-mount-local/_env -@@ -0,0 +1,7 @@ -+export TOPLEVEL_NAMESPACE=nfs-utils -+export PKG_NAMESPACE=nfs-utils -+export RELATIVE_PATH=export-mount-local -+export PACKAGE=nfs-utils -+export PACKAGE_NAME=nfs-utils -+export PKG_LIST=nfs-utils nfs-utils-lib libnfsidmap libsss_idmap libtirpc rpcbind -+export TEST=/nfs-utils/export-mount-local -diff --git a/tests/export-mount-local/runtest.sh b/tests/export-mount-local/runtest.sh -new file mode 100755 -index 0000000..e72e0f4 ---- /dev/null -+++ b/tests/export-mount-local/runtest.sh -@@ -0,0 +1,304 @@ -+#!/bin/bash -+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: test for: export-mount -+# Author: Jianhong Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2014 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh -+. /usr/share/beakerlib/beakerlib.sh || exit 1 -+ -+#=============================================================================== -+ -+#signal trap -+trap "cleanup" SIGINT SIGTERM SIGHUP SIGQUIT -+cleanup() { -+ rlFileRestore -+ rm -rf $expdir $nfsmp -+} -+ -+#global var define -+BZ=exp-mount-local -+expdir=/exportDir-$BZ -+nfsmp=/mnt/nfsmp-$BZ -+subexpdir=/exportDir-$BZ/sub -+tmpnfsmp=/tmp/nfsmp-$BZ -+ -+host="$HOSTNAME" -+# in case "localhost.localdomain" -+echo "$host" | grep -q "localhost" && host="localhost" -+ -+rlJournalStart -+ rlPhaseStartSetup do-Setup- -+ # Load beakerlib you needed -+ rlImport kernel/base -+ read ipv4 _nil <<<$(getDefaultIp) -+ read ipv6s _nil <<<$(getDefaultIp 6 global) -+ ipv6="[$ipv6s]" -+ envinfo -+ rlFileBackup /etc/exports /etc/sysconfig/nfs /etc/nfs.conf /etc/hosts -+ if [ "$host" = "localhost" ]; then -+ run "echo '$ipv4 $host' >> /etc/hosts" -+ if [ -n "$ipv6s" ]; then -+ run "echo '$ipv6s $host' >> /etc/hosts" -+ fi -+ run "cat /etc/hosts" - -+ fi -+ run 'rm -rf $expdir $nfsmp && mkdir -p $expdir $nfsmp' -+ run 'rm -rf $subexpdir $tmpnfsmp && mkdir -p $subexpdir $tmpnfsmp' -+ run 'echo "/tmp *(ro,sync)" >/etc/exports' -+ run 'service_nfs restart' -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ run 'ls_nfsvers' -+ rlPhaseEnd -+ -+for V in $(ls_nfsvers); do -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-ipv4 -+ run "exportfs -au && exportfs -iv $ipv4:$expdir -o ro,sync,no_root_squash" -+ run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -+ run 'umount $nfsmp' -+ rlPhaseEnd -+ if [ -n "$ipv6s" ]; then -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-ipv6-x -+ run 'mount -o vers=$V $ipv6:$expdir $nfsmp' 1-255 -+ [ $? = 0 ] && run "umount $nfsmp" -+ rlPhaseEnd -+ fi -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-host -+ run 'mount -o vers=$V $host:$expdir $nfsmp' -+ run 'umount $nfsmp' -+ rlPhaseEnd -+ -+ if [ -n "$ipv6s" ]; then -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv6 -+ run "exportfs -au && exportfs -iv $ipv6:$expdir -o ro,sync,no_root_squash" -+ run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -+ run 'umount $nfsmp' -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv4-x -+ run 'mount -o vers=$V $ipv4:$expdir $nfsmp' 1-255 -+ [ $? = 0 ] && run "umount $nfsmp" -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-host -+ if [ -n "$(dig -t aaaa $HOSTNAME +short)" ]; then -+ run 'mount -o vers=$V $host:$expdir $nfsmp' -+ run 'umount $nfsmp' -+ fi -+ rlPhaseEnd -+ fi -+ -+ rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-host -+ run "exportfs -au && exportfs -iv $host:$expdir -o ro,sync,no_root_squash" -+ run 'mount -o vers=$V $host:$expdir $nfsmp' -+ run 'umount $nfsmp' -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv4 -+ run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -+ run 'umount $nfsmp' -+ rlPhaseEnd -+ if [ -n "$ipv6s" ]; then -+ rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv6 -+ if [ -n "$(dig -t aaaa $HOSTNAME +short)" ]; then -+ run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -+ run 'umount $nfsmp' -+ fi -+ rlPhaseEnd -+ fi -+ -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv4 -+ run 'echo "$expdir *(ro,sync,no_root_squash)" >/etc/exports' -+ run 'echo "$subexpdir $ipv4(ro,sync,no_root_squash)" >>/etc/exports' -+ run 'service_nfs restart' -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ run 'showmount -e' - -+ run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -+ run 'mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp' -+ run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseEnd -+ if [ -n "$ipv6s" ]; then -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv6-x -+ run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -+ run 'mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp' 1-255 "should not mount sub-directory with different ip" -+ [ $? = 0 ] && run "umount $tmpnfsmp" -+ run "umount $nfsmp" -+ rlPhaseEnd -+ fi -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-host -+ run 'mount -o vers=$V $host:$expdir $nfsmp' -+ run 'mount -o vers=$V $host:$subexpdir $tmpnfsmp' -+ run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseEnd -+ -+ if [ -n "$ipv6s" ]; then -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv4-x -+ run 'echo "$expdir *(ro,sync,no_root_squash)" >/etc/exports' -+ run 'echo "$subexpdir $ipv6s(ro,sync,no_root_squash)" >>/etc/exports' -+ run 'service_nfs restart' -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ run 'showmount -e' - -+ run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -+ run 'mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp' 1-255 "should not mount sub-directory with different ip" -+ [ $? = 0 ] && run "umount $tmpnfsmp" -+ run "umount $nfsmp" -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv6 -+ run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -+ run 'mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp' -+ run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-host -+ run 'mount -o vers=$V $host:$expdir $nfsmp' -+ run 'mount -o vers=$V $host:$subexpdir $tmpnfsmp' -+ run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseEnd -+ fi -+ -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv4 -+ run 'echo "$expdir *(ro,sync,no_root_squash)" >/etc/exports' -+ run 'echo "$subexpdir $host(ro,sync,no_root_squash)" >>/etc/exports' -+ run 'service_nfs restart' -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ run 'showmount -e' - -+ run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -+ run 'mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp' -+ run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseEnd -+ if [ -n "$ipv6s" ]; then -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv6 -+ run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -+ run 'mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp' -+ run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseEnd -+ fi -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-host -+ run 'mount -o vers=$V $host:$expdir $nfsmp' -+ run 'mount -o vers=$V $host:$subexpdir $tmpnfsmp' -+ run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-nfsV$V-default-option-overridden-by-client-specific-option -+ run "echo '$expdir -ro,sync *(rw,no_root_squash)' >/etc/exports" -+ run "service_nfs restart" -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "exports option should be overridden by client specific." -+ run "rm -rf $nfsmp/test*" -+ run "umount $nfsmp" -+ run "echo '$expdir -ro,sec=sys,sync *(rw,no_root_squash)' >/etc/exports" 0 "sec=sys may cause it to be failed." -+ run "exportfs -rv" -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "exports option should be overridden by client specific." -+ run "rm -rf $nfsmp/test*" -+ run "umount $nfsmp" -+ rlPhaseEnd -+done -+ -+ rlPhaseStartTest do-Test-exports-options-twice -+ run 'echo "/ *(sync,hide,no_wdelay)" > /etc/exports' -+ run "service_nfs restart" -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ -+ # Count all options from list printed by exportfs -s(rhel-7) or exportfs -v(rhel-6) -+ allOptions=$( (exportfs -s 2>/dev/null || exportfs -v) | sed 's/^.*(//;s/)$//;s/,/\n/g' | wc -l) -+ # Count unique options from list printed by exportfs -s(rhel-7) or exportfs -v(rhel-6) -+ uniqOptions=$( (exportfs -s 2>/dev/null || exportfs -v) | sed 's/^.*(//;s/)$//;s/,/\n/g' | sort | uniq | wc -l) -+ -+ log "{Info} exportfs -s(rhel-7) or exportfs -v(rhel-6) will print option list for each export path" -+ log "{Info} All options printed by exportfs -s(rhel-7) or exportfs -v(rhel-6) (sorted):" -+ run "(exportfs -s 2>/dev/null || exportfs -v) | sed 's/^.*(//;s/)$//;s/,/\n/g' | sort" -+ log "{Info} For exported path '/', there are $allOptions options printed in all options list and $uniqOptions of them are unique" -+ run 'test $uniqOptions -eq $allOptions' 0 "Should not output any options twice, quantity of all options should be equal to quantity of unique options" -+ for opt in sync hide no_wdelay; do -+ run "(exportfs -s 2>/dev/null || exportfs -v) | grep -q $opt" 0 "Option list should contain option $opt specified in /etc/exports" -+ done -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-server-side-using-bind-mount -+ run "dd if=/dev/zero of=workspace.image bs=3M count=500" -+ run "mkfs -t ext3 -F workspace.image" -+ run "mkdir -p /workspace" -+ run "mount -o loop workspace.image /workspace" -+ run "mkdir -p /workspace/vmcore /srv/nfs/vmcore" -+ run "touch /workspace/work_dir /workspace/vmcore/vmcore_dir" -+ run "mount --bind /workspace/vmcore /srv/nfs/vmcore" -+ run "echo '/srv/nfs/vmcore *(rw,no_root_squash)' > /etc/exports" -+ run "echo '/workspace *(rw,no_root_squash)' >> /etc/exports" -+ run "service_nfs restart" -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ run "mount $host:/workspace $nfsmp" -+ run "ls $nfsmp/work_dir" -+ run "umount $nfsmp" -+ run "exportfs -au" && run "service_nfs stop" -+ run "umount /srv/nfs/vmcore" -+ run "umount /workspace" -+ run "rm -rf /workspace /srv/nfs/vmcore" -+ run "rm workspace.image" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-mount-nfsv4-show-wrong-port -+ run "echo '$expdir *(rw,no_root_squash)' >>/etc/exports" -+ run "service_nfs restart" -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ run "exportfs -v" -+ run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" -+ run "mount -t nfs4 | grep $nfsmp" - -+ run "mount -t nfs4 | grep $nfsmp | grep -q port=2049" 0 "Should show port=2049" -+ run "umount $nfsmp" -+ run "echo '[nfsd]' > /etc/nfs.conf" -+ run "echo 'port=20050' >> /etc/nfs.conf" -+ run "service_nfs restart" -+ run "sleep 10" -+ run "rpcinfo -p | grep -w nfs | grep 20050" -+ run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" - -+ if [ $? -eq 0 ]; then -+ run "mount -t nfs4" - -+ run "mount -t nfs4 | grep -q port=20050" 0 "Should show port=20050" -+ run "umount $nfsmp" -+ fi -+ run "mount -t nfs -o vers=4,port=0 localhost:$expdir $nfsmp" - -+ if [ $? -eq 0 ]; then -+ run "mount -t nfs4" - -+ run "mount -t nfs4 | grep -q port=20050" 0 "Should show port=20050" -+ run "umount $nfsmp" -+ fi -+ run "mount -t nfs -o vers=4,port=20050 localhost:$expdir $nfsmp" -+ run "mount -t nfs4 | grep $nfsmp" - -+ run "mount -t nfs4 | grep $nfsmp | grep -q port=20050" 0 "Should show port=20050" -+ run "umount $nfsmp" -+ rlPhaseEnd -+ -+ rlPhaseStartCleanup do-Cleanup- -+ run 'rm -rf $expdir $nfsmp $subexpdir $tmpnfsmp' -+ rlFileRestore -+ run "service_nfs restart" -+ #avoid issues restarting the server too quickly -+ sleep 10 -+ rlPhaseEnd -+rlJournalEnd -+#rlJournalPrintText -+#enable_avc_check -diff --git a/tests/export-mount-local/subtest.yml b/tests/export-mount-local/subtest.yml -new file mode 100644 -index 0000000..1a77920 ---- /dev/null -+++ b/tests/export-mount-local/subtest.yml -@@ -0,0 +1 @@ -+attr: {ssched: yes} -diff --git a/tests/exportfs/PURPOSE b/tests/exportfs/PURPOSE -new file mode 100644 -index 0000000..3299ed8 ---- /dev/null -+++ b/tests/exportfs/PURPOSE -@@ -0,0 +1,2 @@ -+Description: test for command exportfs -+Author: Stevens Yin -diff --git a/tests/exportfs/_env b/tests/exportfs/_env -new file mode 100644 -index 0000000..b57092a ---- /dev/null -+++ b/tests/exportfs/_env -@@ -0,0 +1,7 @@ -+export TOPLEVEL_NAMESPACE=nfs-utils -+export PKG_NAMESPACE=nfs-utils -+export RELATIVE_PATH=exportfs -+export PACKAGE=nfs-utils -+export PACKAGE_NAME=nfs-utils -+export PKG_LIST=nfs-utils nfs-utils-lib libnfsidmap libsss_idmap libtirpc rpcbind -+export TEST=/nfs-utils/exportfs -diff --git a/tests/exportfs/runtest.sh b/tests/exportfs/runtest.sh -new file mode 100755 -index 0000000..8e34a8c ---- /dev/null -+++ b/tests/exportfs/runtest.sh -@@ -0,0 +1,313 @@ -+#!/bin/bash -+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: test for command exportfs -+# Author: Stevens Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2013 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh -+. /usr/share/beakerlib/beakerlib.sh || exit 1 -+ -+#=============================================================================== -+ -+#setting locale as test check infomration on man pages -+export LC_ALL=en_US.utf8 -+ -+BZ=exportfs -+nfsmp=/mnt/nfsmp-$BZ -+expdir=/expdir-$BZ -+prog=exportfs -+ -+rlJournalStart -+ rlPhaseStartSetup do-Setup -+ # Load beakerlib you needed -+ rlImport kernel/base -+ envinfo -+ read IP4 _nil <<<$(getDefaultIp) -+ read IP6 _nil <<<$(getDefaultIp 6) -+ if echo "$HOSTNAME" | grep -q "localhost"; then -+ hostnamectl set-hostname exportfs.test -+ fi -+ #clean nfs garbage, avoid affect from pre case -+ { exportfs -ua; service nfs stop &>/dev/null; } -+ rlFileBackup /etc/sysconfig/nfs /etc/exports -+ rlFileBackup --clean /etc/exports.d/ -+ run 'rm -f /etc/exports.d/*' -+ run 'mkdir -p $nfsmp $expdir' -+ run 'echo "$expdir *(rw,no_root_squash,fsid=0)" > /etc/exports' -+ service_nfs start -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test"-$prog-with-wrong-option" -+ run 'exportfs -xxxx 2>&1' 1-255 "should exit with an error code" -+ run 'exportfs -xxxx 2>&1 | egrep -i "(usage:|try.*for more info)"' 0 "should output usage to user" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test"-$prog-IpV6" -+ run 'echo "[$IP6]:$expdir"' - -+ run 'exportfs -vi "[$IP6]:$expdir"' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-exportfs-a-and-o-check -+ run 'cp /etc/exports /etc/exports.bak' -+ run 'mkdir ${expdir}2' -+ run 'echo "${expdir}2 *(ro)" >>/etc/exports' -+ run 'exportfs -a' 0 "exportfs -a to export all directories" -+ run 'showmount -e' -+ run 'test $(showmount -e | grep $expdir | wc -l) = 2' 0 "there should be two expdir entries" -+ run 'exportfs -v' -+ run 'exportfs -v | sed -n -e "/\t/! {N; s/[\n\t]/ /g;p}" -e "/\t/p" | -+ grep "${expdir}2" | grep ro | grep -w root_squash' 0 "check the the export options" -+ -+ run 'exportfs -i -o rw,no_root_squash *:${expdir}2' 0 "exportfs -i -o override default export options" -+ run 'exportfs -v' -+ run 'exportfs -v | sed -n -e "/\t/! {N; s/[\n\t]/ /g;p}" -e "/\t/p" | -+ grep "${expdir}2" | grep rw | grep -w no_root_squash' 0 "check if the options be override" -+ run 'mv /etc/exports.bak /etc/exports' 0 "Restore /etc/exports" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-reexport-check -+ run 'exportfs -rv' 0 "exportfs -rv to reexport all directories" -+ run 'exportfs -v | grep "${expdir}2"' 1 "${expdir}2 removed from /etc/exports so no entry about it exported" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-exportfs-u-check -+ run 'exportfs -u' 0 "exportfs -u unexport one or more directories" -+ run 'showmount -e | grep "$expdir"' 0 "$expdir unexport" -+ run 'exportfs *:${expdir}2' -+ run 'exportfs' - -+ run "exportfs -v -u *:$expdir" 0 "unexport one directory only" -+ run 'exportfs' - -+ run "exportfs | grep '${expdir}2'" 0 "${expdir}2 should not be unexported" -+ run 'exportfs -ua' -+ run 'exportfs -f' 0 "exportfs -f flush everything out of the kernel?s export table" -+ run 'rm -rf ${expdir}2' -+ rlPhaseEnd -+ -+ # test NFS_MAXPATHLEN(1024) boundary value test -+ dname=$(echo {1..88}|sed 's/ /_/g') #dname with 254 chars -+ fpath=/$dname/$dname/$dname/$dname #fpath with 1020 chars -+ fpath2=/$dname/$dname/$dname/$dname/abc #fpath with 1024 chars -+ fpath3=/$dname/$dname/$dname/$dname/abckkkk #fpath with 1028 chars -+ rlPhaseStartTest do-Test-exportfs-pathlenth-${#fpath}-${#fpath2}-${#fpath3} -+ run "mkdir -p $fpath" 0 "create a long export path(${#fpath})" -+ run "mkdir -p $fpath2" 0 "create a long export path(${#fpath2})" -+ run "mkdir -p $fpath3" 0 "create a long export path(${#fpath3})" -+ run "exportfs -vi $IP4:$fpath &>std.log" 0 "exportfs long path(${#fpath}) should success" -+ run 'cat std.log' - -+ run 'grep "does not support NFS export" std.log' 1 -+ -+ run "exportfs -vi $IP4:$fpath2 &>std2.log" 0 "exportfs long path(${#fpath2}) should success" -+ run 'cat std2.log' - -+ run 'grep "does not support NFS export" std2.log' 1 -+ -+ run "exportfs -vi $IP4:$fpath3 &>std3.log" 1 "exportfs long path(${#fpath3}) should fail" -+ run 'cat std3.log' - -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-exportfs-dir-with-white-space -+ run 'mkdir -p "/dir with white spaces"' -+ run 'exportfs -vi $IP4:"/dir with white spaces"' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-exportfs-dir-invalid-arg-not-exist -+ run 'exportfs -ua; exportfs -i *:/not.exist &> stdout.log' 1-255 -+ run 'cat stdout.log' - -+ run 'test -n stdout.log' 0 "Path not exist, should output error info to user." -+ run 'cat stdout.log | grep -i usage' 0,1 "should output the usage for invalid argument" -+ run 'exportfs' - -+ run 'test -z "$(exportfs)"' 0,1 "should not exported the invalid path" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-exportfs-dir-without-uuid-and-fsid -+ run 'exportfs -ua; exportfs -i *:/dev/shm &> stdout.log' 1-255 -+ run 'cat stdout.log' - -+ run 'test -n stdout.log' 0 "Path no uuid and fsid, should output error info to user" -+ run 'exportfs' - -+ run 'test -z "$(exportfs)"' 0,1 "should not exported the invalid path" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-exportfs-when-/proc/fs/nfsd-not-mount -+ run 'mkdir -p ${expdir}_tmp' -+ run 'service nfs start' -+ run 'pkill rpc.mountd && umount /proc/fs/nfsd' -+ run 'exportfs -iv *:${expdir}_tmp' -+ run 'mount -t nfsd nfsd /proc/fs/nfsd' 0-255 "restore env: mount nfsd" -+ run 'rm -rf ${expdir}_tmp' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-option-nordirplus -+ #nfsv3 export option nordirplus support test -+ run 'service nfs start' -+ run 'exportfs -i -o nordirplus "*:$expdir"' -+ run 'mount -o vers=3 localhost:$expdir $nfsmp' -+ run 'grep $nfsmp /proc/mounts' -+ run 'grep nfs /proc/mounts | grep nordirplus' - -+ run 'man 5 exports | col -b | grep nordirplus' -+ run 'umount $nfsmp' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-extra-export.d-files-base -+ # test files under /etc/exports.d -+ run 'rm -rf /etc/exports.d' -+ run 'exportfs -r 2>&1 | grep "No such file or directory"' 1 "should not output garbage log" -+ run 'mkdir -p /etc/exports.d' -+ run 'echo "$expdir *(rw,no_root_squash)" > /etc/exports.d/test.exports' -+ run 'cp /etc/exports /etc/exports.bak' -+ run 'echo "" > /etc/exports' -+ run 'cat /etc/exports.d/test.exports' - -+ run 'exportfs -ua; exportfs -a' 0 "export all directories" -+ run 'showmount -e | grep $expdir' -+ run 'mount localhost:$expdir $nfsmp' -+ run 'grep $nfsmp /proc/mounts' -+ run 'umount $nfsmp' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-extra-export.d-files-max-filelen -+ name_max=$(getconf NAME_MAX $expdir) -+ min_export_sz=$(expr length ".exports") -+ max_export_len=$(($name_max-$min_export_sz)) -+ run 'mkdir ${expdir}.max_length' -+ run 'echo "${expdir}.max_length *(ro)" > /etc/exports.d/$(printf "%0${max_export_len}d").exports' -+ run 'ls -la /etc/exports.d/' - -+ run 'exportfs -rv' 0 "exportfs -rv to reexport all directories" -+ run 'showmount -e | grep "max_length"' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-extra-export.d-files-filename-format -+ run 'mkdir ${expdir}.should_ignored' -+ run 'echo "${expdir}.should_ignored *(rw)" > /etc/exports.d/.ignored.exports' -+ run 'echo "${expdir}.should_ignored *(rw)" > /etc/exports.d/ignored.export' -+ run 'echo "${expdir}.should_ignored *(rw)" > /etc/exports.d/exports' -+ run 'ls -la /etc/exports.d/' - -+ run 'exportfs -rv' 0 "exportfs -rv to reexport all directories" -+ run 'showmount -e | grep "should_ignored"' 1 -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-extra-export.d-files-filetype-link -+ run 'ln -s /etc/exports.d/ignored.export /etc/exports.d/linked.exports' -+ run 'ls -la /etc/exports.d/' - -+ run 'exportfs -rv' 0 "exportfs -rv to reexport all directories" -+ run 'showmount -e | grep "should_ignored"' 0 "should consider the link file" -+ run 'test $(showmount -e | grep $expdir | wc -l) = 3' 0 "there should be two expdir entries" -+ run 'rm -rf ${expdir}.*' -+ run 'rm -rf /etc/exports.d' -+ run 'mv /etc/exports.bak /etc/exports' 0 "Restore /etc/exports" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-option-mountpoint -+ run "service_nfs start" -+ run "exportfs -ua" -+ run "mkdir -p ${expdir}_share" -+ run "exportfs -i *:${expdir}_share -o mp" -+ run "exportfs -v" - -+ run "mountpoint ${expdir}_share" 1-255 "It is not mounted yet" -+ # The mount point will still show... but when trying to -+ # mount the directory the client mount should be failed -+ run "showmount -e | grep share" - -+ run "timeout 60 mount localhost:${expdir}_share $nfsmp" 1-123,125-255 "Should be failed without hang" -+ [ $? -eq 0 ] && run "umount $nfsmp" -+ log "{Info} Creating a small fs on loopback device and mount it." -+ run "dd if=/dev/zero of=fs_tmp.img bs=1M count=100" - -+ run "losetup /dev/loop0 fs_tmp.img" - -+ run "mkfs /dev/loop0" - -+ run "mount /dev/loop0 ${expdir}_share" -+ run "mountpoint ${expdir}_share" 0 "It should be mounted now" -+ run "showmount -e | grep share" 0 "Should be listed in output of showmount -e now" -+ run "mount localhost:${expdir}_share $nfsmp" 0 "Should success now" -+ [ $? -eq 0 ] && run "umount $nfsmp" -+ log "{Info} Recovering it." -+ run "service_nfs stop" -+ run "umount ${expdir}_share" -+ run "losetup -d /dev/loop0" - -+ run "rm -f fs_tmp.img" - -+ run "rm -rf ${expdir}_share" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"exportfs -u incorrectly exits with a 1 whenever the exportlist has multiple FQDN exports" -+ run "exportfs -ua" -+ run "exportfs -v" - -+ run "exportfs -o rw,sync localhost:$expdir" -+ run "exportfs -o rw,sync $IP4:$expdir" -+ run "exportfs -v" - -+ run 'test $(exportfs -v | grep $expdir | wc -l) = 2' -+ run "exportfs -u $IP4:$expdir" 0 "should not exit with 1 when the exportlist has multiple FQDN exports" -+ run "exportfs -v" - -+ run 'test $(exportfs -v | grep $expdir | wc -l) = 1' -+ run "exportfs -u localhost:$expdir" -+ run "exportfs -v" - -+ run 'test $(exportfs -v | grep $expdir | wc -l) = 0' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"exportfs -u cannot unexport when the specified path involves a trailing /" -+ run "exportfs -ua" -+ run "exportfs -o rw,sync localhost:$expdir" -+ run "exportfs -u not.exist:$expdir" 1-255 "should be failed and return error code" -+ run "exportfs -v" - -+ run "test $(exportfs | wc -l) -ne 0" 0 "Should not be cleared as previous cmd failed" -+ run "exportfs -u localhost:$expdir/" 0 "Should unexport even if path involves trailing /" -+ run "exportfs -v" - -+ run "test $(exportfs | wc -l) -eq 0" 0 "Should have nothing to export" -+ run "exportfs -ua" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"exportfs -u can exit with status 1 if there are multiple ip exports that cannot be resolved to hostnames" -+ # Should test with un-used ip address -+ run "ping -c 1 192.168.1.100 >/dev/null || ping -c 1 192.168.1.101 >/dev/null" 1 -+ [ "$?" = "0" ] && { -+ log "{WARN} Should test with un-used ip address, skip the test." -+ report_result $TEST FAIL -+ exit 0 -+ } -+ run "exportfs -ua && exportfs -v" - -+ log "{INFO} Test with ip that cannot be resolved to a hostname." -+ run "exportfs -o rw,sync 192.168.1.100:$expdir" -+ run "exportfs -o rw,sync 192.168.1.101:$expdir" -+ run "exportfs -v" - -+ run 'test $(exportfs -v | grep $expdir | wc -l) = 2' -+ run "exportfs -u 192.168.1.101:$expdir" 0 "Should not exit with 1 if unexports successfully." -+ run "exportfs -v" - -+ run 'test $(exportfs -v | grep $expdir | wc -l) = 1' -+ run "exportfs -u 192.168.1.100:$expdir" 0 "Should not exit with 1 if unexports successfully." -+ run "exportfs -v" - -+ run 'test $(exportfs -v | grep $expdir | wc -l) = 0' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-'exportfs: support "security_label" export option' -+ run "exportfs -ua && exportfs -v" - -+ run "exportfs -o security_label localhost:$expdir" -+ run "exportfs -v" - -+ run "exportfs -v | grep -q security_label" -+ run "exportfs -ua" -+ rlPhaseEnd -+ -+ rlPhaseStartCleanup do-Cleanup -+ rlFileRestore -+ if echo "$HOSTNAME" | grep -q "localhost"; then -+ hostnamectl set-hostname $HOSTNAME -+ fi -+ rm -rf $nfsmp $expdir -+ run "service_nfs restart" -+ rlPhaseEnd -+rlJournalEnd -+#rlJournalPrintText -+ -diff --git a/tests/mount/PURPOSE b/tests/mount/PURPOSE -new file mode 100644 -index 0000000..3c215eb ---- /dev/null -+++ b/tests/mount/PURPOSE -@@ -0,0 +1,2 @@ -+Description: Test for command mount.nfs{,4} -+Author: Stevens Yin -diff --git a/tests/mount/_env b/tests/mount/_env -new file mode 100644 -index 0000000..d016f7c ---- /dev/null -+++ b/tests/mount/_env -@@ -0,0 +1,7 @@ -+export TOPLEVEL_NAMESPACE=nfs-utils -+export PKG_NAMESPACE=nfs-utils -+export RELATIVE_PATH=mount -+export PACKAGE=nfs-utils -+export PACKAGE_NAME=nfs-utils -+export PKG_LIST=nfs-utils nfs-utils-lib libnfsidmap libsss_idmap libtirpc rpcbind -+export TEST=/nfs-utils//mount -diff --git a/tests/mount/runtest.sh b/tests/mount/runtest.sh -new file mode 100755 -index 0000000..fb2f585 ---- /dev/null -+++ b/tests/mount/runtest.sh -@@ -0,0 +1,113 @@ -+#!/bin/bash -+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: Test for command mount.nfs{,4} -+# Author: Stevens Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2013 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh -+. /usr/share/beakerlib/beakerlib.sh || exit 1 -+ -+#=============================================================================== -+ -+mnt=/nfs-mount -+expdir=/expdir -+expdir_with_more_slash=$expdir///expdir-mount -+prog=mount.nfs -+ -+rlJournalStart -+ rlPhaseStartSetup do-Setup -+ # Load beakerlib you needed -+ rlImport kernel/base -+ envinfo -+ read IP4 _nil <<<$(getDefaultIp) -+ rlFileBackup /etc/sysconfig/nfs /etc/exports -+ run "mkdir -p $mnt $expdir $expdir_with_more_slash" -+ run "echo '$expdir *(rw,no_root_squash)' > /etc/exports" -+ run "echo '$expdir_with_more_slash *(rw,no_root_squash)' >> /etc/exports" -+ run 'service_nfs restart' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-$prog-with-wrong-option -+ run "$prog -xxxx" 1-255 "should exit with an error code" -+ run "$prog -xxxx 2>&1 | egrep -i '(usage:|try.*for more info)'" 0 "should output usage to user" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-$prog-without-args -+ run "$prog" 1-255 "should exit with an error code" -+ run "$prog 2>&1 | egrep -i '(usage:|try.*for more info)'" 0 "should output usage to user" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-$prog--h -+ run "$prog -h" - -+ std=$($prog -h 2>&1) -+ run "$prog -h 2>&1 | egrep -i usage:" 0 "should output usage to user" -+ [ $? = 0 ] && { -+ options=$(echo "$std"|grep -o '\[-[a-z]\+\]') -+ [ ${#options} -gt 3 ] && { -+ optionNuma=$((${#options} - 3)) -+ optionNumb=$(echo "$std" | sed -n "/\t-$options/p" | wc -l) -+ optionNumc=$(echo "$std" | sed -n "/\t-[a-zA-Z]/p" | wc -l) -+ run "test $optionNuma = $optionNumb" -+ run "test $optionNuma = $optionNumc" -+ run 'echo "$std" | sed -n "/\t-$options/p" | grep " "' 1 -+ } -+ } -+ rlPhaseEnd -+ -+if rpcinfo -p | awk '$2=="2"' | grep -q -w nfs; then -+ rlPhaseStartTest do-Test-$prog--o-vers=2 -+ run "$prog localhost:$expdir $mnt -o vers=2" -+ run "umount -vvv $mnt &> >(tee verbose.log)" -+ run 'test $(wc -l >(tee verbose.log)" -+ run 'test $(wc -l >(tee verbose.log)" -+ run 'test $(wc -l -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2006 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh -+. /usr/share/beakerlib/beakerlib.sh || exit 1 -+ -+#=============================================================================== -+ -+TESTNAME=${TEST/*\//} -+expdir=/exportdir/home -+nfsmp=/mnt/$TESTNAME -+ -+ORIGINAL_HOSTNAME=$HOSTNAME -+ -+rlJournalStart -+ rlPhaseStartSetup do-$role-Setup- -+ # Load beakerlib you needed -+ rlImport kernel/base -+ envinfo -+ rlFileBackup /etc/sysconfig/nfs /etc/exports -+ if echo "$HOSTNAME" | grep -q "localhost"; then -+ # In case "localhost.localdomain" -+ hostnamectl set-hostname nfs-mount-options-all.test -+ HOSTNAME=nfs-mount-options-all.test -+ fi -+ run 'rm -rf $expdir $nfsmp && mkdir -p $expdir $nfsmp' -+ run 'chmod 777 $expdir' -+ run 'echo "$expdir *(rw,sync,no_root_squash)" >/etc/exports' -+ run 'service_nfs restart' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-$role-Test-fg_bg_retry_devil -+ read IP4 _nil <<<$(getDefaultIp) -+ run 'iptables -F' - -+ MNT_OPTS="vers=3,soft,fg,retry=1" -+ log "{Info} Retry 1 minute (60s) NFS mount in *foreground* before giving up." -+ run 'iptables -A INPUT -s $IP4 -j DROP' - -+ run 'iptables -L' - -+ run 'sleep 10' -+ start_time=$(date +%s) -+ run "mount ${IP4}:$expdir $nfsmp -o ${MNT_OPTS}" 1-255 -+ retry_time=$((`date +%s` - start_time)) -+ log "{Info} Actually the nfs.mount hang $retry_time seconds." -+ run 'ps aux | grep -v grep | grep ${MNT_OPTS}' 1 -+ run 'iptables -F' - -+ run 'ip6tables -F' - -+ run 'mountpoint $nfsmp && umount $nfsmp' 1 -+ -+ MNT_OPTS="vers=3,soft,bg,retry=1" -+ log "{Info} Retry 1 minute (60s) NFS mount in *background* before giving up." -+ run 'iptables -A INPUT -s $IP4 -j DROP' - -+ run 'iptables -L' - -+ run 'sleep 10' -+ # When background exit and fork an childprocess, still, returns 0 -+ run "mount ${IP4}:$expdir $nfsmp -o ${MNT_OPTS}" 0 "should return ok" -+ if [ $? -eq 0 ]; then -+ # bg ground, the mount fork an child process -+ run 'ps aux | grep -v grep | grep ${MNT_OPTS}' 0 "works in bg.. show background process" -+ [ $? = 0 ] && { -+ log "{Info} We are sleeping a little longer than 60 seconds (retry=1)." -+ run "sleep $((retry_time + 10))" 0 "Actually a little more than $retry_time seconds." -+ # demo mounting process should exit after 60s as retry=1 (minute) -+ run 'ps aux | grep -v grep | grep ${MNT_OPTS}' 1 "retry=1 for 60s should works file after sleep 70s" -+ } -+ fi -+ run 'iptables -F' - -+ # should not mount successfully as it expired -+ run 'mountpoint $nfsmp && umount $nfsmp' 1 -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-retry-option-should-not-be-ignored -+ # test retry of the default value (2 minutes) for foreground - NFS(5) -+ run "service_nfs stop" -+ run "mount ${HOSTNAME}:$expdir $nfsmp &" -+ run "sleep 100 ; service_nfs start ; sleep 10" -+ run "nfsstat -m | grep $nfsmp" 0 -+ [ $? = 0 ] && run "umount $nfsmp" -+ -+ # test retry of 10 minutes for foreground -+ MNT_OPTS="retry=10" -+ log "\n{Info} ${MNT_OPTS}" -+ run "service_nfs stop" -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS} &" -+ run "sleep 10 ; service_nfs start ; sleep 10" -+ run "nfsstat -m | grep $nfsmp" 0 -+ [ $? = 0 ] && run "umount $nfsmp" -+ -+ # test retry of 100 minutes for background -+ MNT_OPTS="bg,retry=100" -+ log "\n{Info} ${MNT_OPTS}" -+ run "service_nfs stop" -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" -+ run "sleep 10 ; service_nfs start ; sleep 10" -+ run "nfsstat -m | grep $nfsmp" -+ [ $? = 0 ] && run "umount $nfsmp" -+ -+ # test retry of the default value (10000 minutes) for background - NFS(5) -+ MNT_OPTS="bg" -+ log "\n{Info} ${MNT_OPTS}" -+ run "service_nfs stop" -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" -+ run "sleep 10 ; service_nfs start ; sleep 10" -+ run "nfsstat -m | grep $nfsmp" -+ [ $? = 0 ] && run "umount $nfsmp" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-$role-Test-resvport_noresvport_test -+ run 'service_nfs restart' -+ MNT_OPTS="resvport" -+ log "{Info} ${MNT_OPTS}" -+ run 'mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}' 0 -+ run 'mountpoint $nfsmp && umount $nfsmp' -+ -+ MNT_OPTS="noresvport" -+ log "{Info} ${MNT_OPTS}" -+ run 'mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}' 1-255 "should got permission denied" -+ run 'mountpoint $nfsmp && umount $nfsmp' 1 -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-$role-Test-cache_nocache_test -+ MNT_OPTS="noac" -+ log "\n{Info} ${MNT_OPTS}" -+ run 'chmod 777 $expdir' -+ run 'touch $expdir/foo.txt && chmod 777 $expdir/foo.txt' -+ run 'service_nfs restart' -+ run 'mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}' 0 -+ [ $? -eq 0 ] && { -+ ATTR_TMP1=$(ls -al $nfsmp | grep foo.txt | awk '{ print $1 }') -+ chmod 666 $expdir/foo.txt -+ sleep 1 -+ ATTR_TMP2=$(ls -al $nfsmp | grep foo.txt | awk '{ print $1 }') -+ log "{Info} $ATTR_TMP1 ~ $ATTR_TMP2" -+ run "[ x"$ATTR_TMP1" != x"$ATTR_TMP2" ]" 0 "with noac, attribution should not cached" -+ } -+ run 'mountpoint $nfsmp && umount $nfsmp' -+ run 'rm -f $expdir/foo.txt' -+ -+ MNT_OPTS="ac,acregmin=20,acregmax=40,acdirmin=30,acdirmax=60" -+ log "\n{Info} ${MNT_OPTS}" -+ run 'touch $expdir/foo.txt && chmod 777 $expdir/foo.txt' -+ run 'mkdir $expdir/foo.dir && chmod 777 $expdir/foo.dir' -+ run 'mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}' -+ [ $? -eq 0 ] && { -+ ATTR_TMPREG1=$(ls -al $nfsmp | grep foo.txt | awk '{ print $1 }') -+ ATTR_TMPDIR1=$(ls -al $nfsmp | grep foo.dir | awk '{ print $1 }') -+ chmod 666 $expdir/foo.txt -+ chmod 555 $expdir/foo.dir -+ sleep 7 -+ ATTR_TMPREG2=$(ls -al $nfsmp | grep foo.txt | awk '{ print $1 }') -+ sleep 7 #7+7 -+ ATTR_TMPDIR2=$(ls -al $nfsmp | grep foo.dir | awk '{ print $1 }') -+ sleep 30 #7+7+30 -+ ATTR_TMPREG3=$(ls -al $nfsmp | grep foo.txt | awk '{ print $1 }') -+ sleep 20 #7+7+30+20 -+ ATTR_TMPDIR3=$(ls -al $nfsmp | grep foo.dir | awk '{ print $1 }') -+ -+ log "{Info} Regfile Attribution: $ATTR_TMPREG1 ~ $ATTR_TMPREG2 ~ $ATTR_TMPREG3" -+ run '[ x"$ATTR_TMPREG1" == x"$ATTR_TMPREG2" -a x"$ATTR_TMPREG1" != x"$ATTR_TMPREG3" ]' -+ -+ log "{Info} Directory Attribution: $ATTR_TMPDIR1 ~ $ATTR_TMPDIR2 ~ $ATTR_TMPDIR3" -+ run '[ x"$ATTR_TMPDIR1" == x"$ATTR_TMPDIR2" -a x"$ATTR_TMPDIR1" != x"$ATTR_TMPDIR3" ]' -+ } -+ run 'mountpoint $nfsmp && umount $nfsmp' -+ run 'rm -f $expdir/foo.txt' -+ run 'rm -rf $expdir/foo.dir' -+ -+ MNT_OPTS="ac,actimeo=20" -+ log "\n{Info} ${MNT_OPTS}" -+ run 'mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}' -+ [ $? -eq 0 ] && { -+ run 'grep ${TESTNAME} /proc/mounts | grep "acregmin=20" | grep "acregmax=20" | grep "acdirmin=20" | grep "acdirmax=20"' -+ } -+ run 'mountpoint $nfsmp && umount $nfsmp' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-$role-Test-sharecache_nosharecache_test -+ MNT_OPTS="vers=3,nosharecache" -+ MNT_OPTS="nosharecache,ac,acregmin=30,acregmax=60" -+ log "\n{Info} ${MNT_OPTS}" -+ run 'chmod 777 $expdir' -+ run 'touch $expdir/foo.txt && chmod 777 $expdir/foo.txt' -+ run 'mkdir -p $nfsmp-{1,2}' -+ run 'service_nfs restart' -+ -+ run 'mount ${HOSTNAME}:$expdir $nfsmp-1 -o ${MNT_OPTS} && -+ mount ${HOSTNAME}:$expdir $nfsmp-2 -o ${MNT_OPTS}' -+ [ $? = 0 ] && { -+ chmod 555 $nfsmp-1/foo.txt -+ sleep 1 -+ chmod 444 $nfsmp-2/foo.txt -+ -+ ATTR_TMPREG1=$(ls -al $nfsmp-1 | grep foo.txt | awk '{ print $1 }') -+ ATTR_TMPREG2=$(ls -al $nfsmp-2 | grep foo.txt | awk '{ print $1 }') -+ ATTR_TMPREG3=$(ls -al $expdir/ | grep foo.txt | awk '{ print $1 }') -+ -+ log "{Info} $ATTR_TMPREG1 ~ $ATTR_TMPREG2 ~ $ATTR_TMPREG3" -+ run '[ x"$ATTR_TMPREG1" == x"$ATTR_TMPREG2" -a x"$ATTR_TMPREG1" == x"$ATTR_TMPREG3" ]' -+ } -+ run 'mountpoint $nfsmp-1 && umount $nfsmp-1' -+ run 'mountpoint $nfsmp-2 && umount $nfsmp-2' -+ run 'rm -f $expdir/foo.txt' -+ run 'rm -rf $nfsmp-{1,2}' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-$role-Test-lookupcache_test -+ MNT_OPTS="ac,acdirmin=30,acdirmax=60,lookupcache=pos" -+ log "\n{Info} ${MNT_OPTS}" -+ run 'chmod 777 $expdir' -+ run 'mkdir -p $expdir/foodir && touch $expdir/foodir/foo-1.txt' -+ run 'service_nfs restart' -+ run 'mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}' -+ [ $? = 0 ] && { -+ run 'ls -l $nfsmp/foodir/ | grep foo-1.txt' -+ run 'rm -f $expdir/foodir/foo-1.txt' -+ run 'sleep 1' - -+ log "{Info} Checking again..." -+ run 'ls -l $nfsmp/foodir/ | grep foo-1.txt' 1 -+ run 'umount $nfsmp' -+ } -+ run 'rm -fr $expdir' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-$role-Test-rsize-wsize -+ minSize=1024 -+ minFixSize=4096 -+ #maxSize=1048576 -+ run "cat /proc/fs/nfsd/max_block_size" 0 "The default max block size varies depending on RAM size, with a maximum of 1M." -+ maxSize=$(cat /proc/fs/nfsd/max_block_size) -+ run 'mkdir -p $expdir' -+ run 'echo "$expdir *(rw,sync,no_root_squash)" > /etc/exports' -+ run 'service_nfs restart' -+ MNT_OPTS="rsize=1024,wsize=1024" -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" -+ run 'grep $nfsmp /proc/mounts' - -+ run "cat /proc/mounts | grep -q $MNT_OPTS" -+ run 'umount $nfsmp' -+ MNT_OPTS="rsize=8192,wsize=8192" -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" -+ run 'grep $nfsmp /proc/mounts' - -+ run "cat /proc/mounts | grep -q $MNT_OPTS" -+ run 'umount $nfsmp' -+ MNT_OPTS="rsize=1,wsize=255" # less than min_size($minSize) -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" -+ run 'grep $nfsmp /proc/mounts' - -+ run "cat /proc/mounts | grep -q rsize=$minFixSize,wsize=$minFixSize" 0 "Specified values lower than $minSize are replaced with $minFixSize" -+ run 'umount $nfsmp' -+ MNT_OPTS="rsize=1048577,wsize=2048576" # great than max_size($maxSize) -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" -+ run 'grep $nfsmp /proc/mounts' - -+ run "cat /proc/mounts | grep -q rsize=$maxSize,wsize=$maxSize" 0 "Specified values more than $maxSize are replaced with $maxSize" -+ run 'umount $nfsmp' -+ MNT_OPTS="rsize=0,wsize=0" -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" -+ run 'grep $nfsmp /proc/mounts' - -+ run "cat /proc/mounts | grep -q rsize=$maxSize,wsize=$maxSize" 0 "Specified values more than $maxSize are replaced with $maxSize" -+ run 'umount $nfsmp' -+ MNT_OPTS="rsize=-1,wsize=-3" -+ run "mount ${HOSTNAME}:$expdir $nfsmp -o ${MNT_OPTS}" 1-255 -+ rlPhaseEnd -+ -+for V in $(ls_nfsvers); do -+ rlPhaseStartTest do-$role-NFS-mount-options-can-be-lost-when-using-bg-option-vers${V} -+ run 'service_nfs stop' -+ run 'mount -v -t nfs -o rw,bg,hard,nointr,tcp,vers=$V,timeo=600,rsize=32768,wsize=32768,actimeo=0,noac localhost:$expdir $nfsmp' -+ run 'service_nfs start' -+ run 'while ! grep -q $nfsmp /proc/mounts; do sleep 15; done' - -+ run 'grep $nfsmp /proc/mounts' -+ run 'grep $nfsmp /proc/mounts | grep -q "rw,sync"' -+ if [ "$V" = "2" ]; then -+ run 'grep $nfsmp /proc/mounts | grep -q "vers=$V,rsize=8192,wsize=8192"' -+ else -+ run 'grep $nfsmp /proc/mounts | grep -q "vers=$V,rsize=32768,wsize=32768"' -+ fi -+ run 'grep $nfsmp /proc/mounts | grep -q "acregmin=0,acregmax=0,acdirmin=0,acdirmax=0,hard,noac,proto=tcp"' -+ run 'grep $nfsmp /proc/mounts | grep -q "timeo=600,retrans=2,sec=sys"' -+ run "umount $nfsmp" -+ rlPhaseEnd -+done -+ -+ rlPhaseStartTest do-$role-Test-"mount-nfs-needs-descriptive-error-when-nfsvers-specified-incorrectly" -+ run "log=`mktemp -q`" 0 "Creating temporary log file" -+ log "{Info} Specify the invalid value." -+ for vers in {"v3","vers","+","*",""}; do -+ run "mount -t nfs -o vers=$vers localhost:$expdir $nfsmp 2>$log" 32 \ -+ "should be failed as expected using invalid value" -+ run "mount -t nfs -o nfsvers=$vers localhost:$expdir $nfsmp 2>>$log" 32 \ -+ "should be failed as expected using invalid value" -+ run "cat $log" - -+ run "egrep -q 'Bad nfs mount parameter|parsing error|invalid value' $log" -+ run ">$log" 0 "clear $log content" -+ done -+ log "{Info} Specify the valid number (maybe not supported)." -+ run "ls_nfsvers" - -+ for vers in {1,2,3,4,5,23}; do -+ if ls_nfsvers | grep -q "^$vers"; then -+ run "mount -t nfs -o vers=$vers localhost:$expdir $nfsmp" -+ run "umount $nfsmp" -+ run "mount -t nfs -o nfsvers=$vers localhost:$expdir $nfsmp" -+ run "umount $nfsmp" -+ else -+ run "mount -t nfs -o vers=$vers localhost:$expdir $nfsmp 2>$log" 32 \ -+ "should be failed as expected using unsupported version" -+ [ $? = 0 ] && run "umount $nfsmp" -+ run "mount -t nfs -o nfsvers=$vers localhost:$expdir $nfsmp 2>>$log" 32 \ -+ "should be failed as expected using unsupported version" -+ [ $? = 0 ] && run "umount $nfsmp" -+ run "cat $log" - -+ run "egrep -q 'not supported|parsing error|invalid value|call failed' $log" -+ run ">$log" 0 "clear $log content" -+ fi -+ done -+ run "rm -f $log" 0 "Remove temporary log file" -+ rlPhaseEnd -+ -+ rlPhaseStartCleanup do-$role-Cleanup- -+ run 'mountpoint $nfsmp && umount $nfsmp' 1 -+ hostnamectl set-hostname $ORIGINAL_HOSTNAME -+ run 'rm -rf $expdir $nfsmp' -+ rlFileRestore -+ run 'service_nfs restart' -+ rlPhaseEnd -+rlJournalEnd -+#rlJournalPrintText -+ -diff --git a/tests/systemd-nfs/PURPOSE b/tests/systemd-nfs/PURPOSE -new file mode 100644 -index 0000000..556df42 ---- /dev/null -+++ b/tests/systemd-nfs/PURPOSE -@@ -0,0 +1 @@ -+# nothing -diff --git a/tests/systemd-nfs/_env b/tests/systemd-nfs/_env -new file mode 100644 -index 0000000..d90f45d ---- /dev/null -+++ b/tests/systemd-nfs/_env -@@ -0,0 +1,7 @@ -+export TOPLEVEL_NAMESPACE=nfs-utils -+export PKG_NAMESPACE=nfs-utils -+export RELATIVE_PATH=systemd-nfs -+export PACKAGE=nfs-utils -+export PACKAGE_NAME=nfs-utils -+export PKG_LIST=nfs-utils nfs-utils-lib libnfsidmap libsss_idmap libtirpc rpcbind -+export TEST=/nfs-utils/systemd-nfs -diff --git a/tests/systemd-nfs/runtest.sh b/tests/systemd-nfs/runtest.sh -new file mode 100755 -index 0000000..227ec36 ---- /dev/null -+++ b/tests/systemd-nfs/runtest.sh -@@ -0,0 +1,287 @@ -+#!/bin/bash -+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: test for: nfs -+# Author: Jianhong Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2014 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh -+. /usr/share/beakerlib/beakerlib.sh || exit 1 -+ -+#=============================================================================== -+ -+#signal trap -+trap "cleanup" SIGINT SIGTERM SIGHUP SIGQUIT -+cleanup() { -+ rlFileRestore -+ run 'service_nfsconfig restart' -+ #rm -rf $expdir $nfsmp -+} -+ -+#global var define -+serv=nfs -+rpm -q systemd || { -+ echo "{Warn} no systemd installed, skip the test" -+ report_result $TEST PASS -+ exit 0 -+} -+ -+rlJournalStart -+ rlPhaseStartSetup do-Setup- -+ # Load beakerlib you needed -+ rlImport kernel/base -+ envinfo -+ rlFileBackup /etc/exports /etc/sysconfig/nfs -+ run 'echo "/usr/share *(ro)" >/etc/exports' -+ run 'echo "RPCNFSDARGS=8" >/etc/sysconfig/nfs' 0 "avoid invalid config file" -+ run 'service_nfsconfig restart' 0 "RHEL-7.1 or later need restart nfs-config to reload /etc/sysconfig/nfs" -+ run "useradd testuserqa" - -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-start -+ run "service_$serv start" 0 "Service must start without problem" -+ run "service_$serv status" 0 "Then Status command" -+ run "service_$serv start" 0 "Already started service" -+ run "service_$serv status" 0 "Again status command" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-restart -+ run "service_$serv restart" 0 "Restarting of service" -+ run "service_$serv status" 0 "Status command" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-stop -+ run "service_$serv stop" 0 "Stopping service" -+ run "service_$serv status" 3 "Status of stopped service" -+ run "service_$serv stop" 0 "Stopping service again" -+ run "service_$serv status" 3 "Status of stopped service" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"insufficient-rights" -+ run "service_$serv restart " 0 "Starting service for restarting under nonpriv user" -+ run "su testuserqa -c 'service_$serv stop'" 1,4 "Insufficient rights, stopping service under nonprivileged user must fail" -+ run "su testuserqa -c 'service_$serv start'" 0,1,4 "Insufficient rights, starting service under nonprivileged user must fail or pass as already started" -+ run "su testuserqa -c 'service_$serv status'" 0 "Sufficient rights, service status should be accessible to nonprivileged users" -+ run "service_$serv stop" 0 "Stopping service for starting under nonpriv user" -+ run "su testuserqa -c 'service_$serv start'" 1,4 "Insufficient rights, starting of stopped service under nonprivileged user must fail" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"operations" -+ run "service_$serv start" 0 "Service have to implement start function" -+ run 'sleep 5' 0 "sleep a while avoid the start rate limit" -+ run "service_$serv restart" 0 "Service have to implement restart function" -+ run "service_$serv status" 0 "Service have to implement status function" -+ run 'sleep 5' 0 "sleep a while avoid the start rate limit" -+ run "service_$serv condrestart" 0 "Service have to implement condrestart function" -+ [ $? != 0 ] && run "journalctl -xn" - -+ run 'sleep 5' 0 "sleep a while avoid the start rate limit" -+ run "service_$serv try-restart" 0 "Service have to implement try-restart function" -+ [ $? != 0 ] && run "journalctl -xn" - -+ run "service_$serv reload" 0 "Service have to implement reload function" -+ [ $? != 0 ] && run "journalctl -xn" - -+ run "service_$serv force-reload" 0 "Service have to implement force-reload function" -+ [ $? != 0 ] && run "journalctl -xn" - -+ run "service_$serv noexistop" 2 "Testing proper return code when nonexisting function" -+ rlPhaseEnd -+ -+ # Should do nothing if a service is already stopped or not running (according to manpage of systemctl) -+ # http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT -+ rlPhaseStartTest do-Test-"operations-stopped" -+ run "service_$serv stop" 0 "Service have to implement stop function" -+ run "service_$serv condrestart" 0 "Service have to implement condrestart function" -+ run "service_$serv try-restart" 0 "Service have to implement try-restart function" -+ run "service_$serv force-reload" 0 "Service have to implement force-reload function" -+ run "service_$serv status" 3 "Above oprations should do nothing if service are not running" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-enable-disable-$serv -+ if systemctl --quiet is-enabled $serv; then -+ run "systemctl disable $serv" 0 "Disable service on boot" -+ run "systemctl is-enabled $serv" 1 "Check whether service is disabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "systemctl enable $serv" 0 "Enable service on boot" -+ run "systemctl is-enabled $serv" 0 "Check whether service is enabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ else -+ run "systemctl enable $serv" 0 "Enable service on boot" -+ run "systemctl is-enabled $serv" 0 "Check whether service is enabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "systemctl disable $serv" 0 "Disable service on boot" -+ run "systemctl is-enabled $serv" 1 "Check whether service is disabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ fi -+ rlPhaseEnd -+ -+ # ystemctl enable fails for symlinks in /usr/lib/systemd/system -+ # Use a workaround to test enable/disable with nfs-server.service -+ rlPhaseStartTest do-Test-enable-disable-nfs-server -+ if systemctl --quiet is-enabled nfs-server; then -+ run "systemctl disable nfs-server" 0 "Disable nfs-serverice on boot" -+ run "systemctl is-enabled nfs-server" 1 "Check whether nfs-serverice is disabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "systemctl enable nfs-server" 0 "Enable nfs-serverice on boot" -+ run "systemctl is-enabled nfs-server" 0 "Check whether nfs-serverice is enabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ else -+ run "systemctl enable nfs-server" 0 "Enable nfs-serverice on boot" -+ run "systemctl is-enabled nfs-server" 0 "Check whether nfs-serverice is enabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "systemctl disable nfs-server" 0 "Disable nfs-serverice on boot" -+ run "systemctl is-enabled nfs-server" 1 "Check whether nfs-serverice is disabled" -+ run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ fi -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-nfsv4-only -+ run 'service nfs stop' -+ # MOUNTD_NFS_V2 MOUNTD_NFS_V3 was not supported in RHEL-7.x -+ run 'echo -e "RPCMOUNTDOPTS=\"-N 2 -N 3\"" >>/etc/sysconfig/nfs' 0 "enabling nfsv4 only" -+ # If in RHEL-7.1 or later need restart nfs-config service to flush /etc/sysconfig/nfs to /run/sysconfig/nfs-utils -+ # But since RHEL-7.3, nfs-config change to be ru-run during the dependent service starting -+ run 'service_nfsconfig status &>/dev/null && service_nfsconfig restart' - -+ run 'cat /run/sysconfig/nfs-utils | grep RPCMOUNTDARGS | grep "\""' 0 "quote variable in /run/sysconfig/nfs-utils" -+ run 'sleep 5' 0 "sleep a while avoid service script bug" -+ run 'service_nfs start' -+ run 'rpcinfo -s | grep -w mountd' 1 "if nfsv4 only, no mountd info in rpcinfo" -+ rlFileRestore /etc/sysconfig/nfs -+ run 'service_nfsconfig restart' -+ rlPhaseEnd -+ -+ # Since nfs-service no longer starts the daemons in question. They are now split -+ # into their own services (nfs-mountd.service, rpc-statd.service, nfs-idmapd.service). -+ # Then `systemctl status nfs-server.service` cannot accurately reflect the -+ # state of the combination of daemons that are needed for a working NFS server. -+ rlPhaseStartTest do-Test-"nfs-server-is-active-even-processes-terminated" -+ run 'service_nfs restart' -+ run 'pkill rpc.mountd' - -+ run 'killall -9 nfsd' - -+ run 'ps axf | grep -e "rpc.mountd" -e "nfsd"' - -+ run 'service nfs-mountd status' 1-255 -+ run 'rpcinfo -t localhost 100005' 1 "pings mountd" -+ log '{Info} nfsserver resource agent has been updated to monitor all its daemons' -+ run 'service_nfs status' 1-255,0 -+ run 'service_nfs status 2>&1 | grep "active"' - -+ run 'service_nfs stop' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"should-auto-mount-/proc/fs/nfsd" -+ run 'service_nfs restart' -+ run 'service_nfs stop' -+ run 'umount /proc/fs/nfsd' -+ run 'service_nfs start 2>&1 | grep "mount -t nfsd"' 1 "should auto mount nfsd" -+ run 'mount -t nfsd nfsd /proc/fs/nfsd' - -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"use-rpcbind.service-in-nfs-server.service" -+ run "systemctl reset-failed" 0 "workaround for failure of starting too often" -+ log "{Info} Starting nfs while rpcbind is stopped" -+ run "service rpcbind stop; service rpcbind stop" 0 "stop twice as workaround" -+ run "service rpcbind status" 3 "rpcbind.service should be stopped" -+ run "service nfs restart" -+ run "service nfs status" 0 "should start nfs successfully" -+ run "service rpcbind status" 0 "starting nfs should bring rpcbind up" -+ -+ log "{Info} Starting nfs while rpcbind is active" -+ run "service rpcbind start" -+ run "service rpcbind status" 0 "rpcbind should be active" -+ run "service nfs restart" -+ run "service nfs status" 0 "should start nfs successfully" -+ run "service rpcbind status" 0 "starting nfs should keep rpcbind up" -+ -+ log "{Info} Stopping nfs while rpcbind is active" -+ run "service rpcbind start" -+ run "service rpcbind status" 0 "rpcbind should be active" -+ run "service nfs start; service nfs status" -+ run "service nfs stop; service nfs status" 3 -+ run "service rpcbind status" 0 "stopping nfs should keep rpcbind up" -+ -+ log "{Info} Stopping nfs while rpcbind is stopped" -+ run "service nfs start" 0 "firstly start nfs since it can bring rpcbind up" -+ run "service nfs status" 0 "should start nfs successfully" -+ run "service rpcbind stop; service rpcbind stop" 0 "stop twice as workaround" -+ run "service rpcbind status" 3 "rpcbind should be stopped" -+ run "service nfs stop" -+ # If a daemon tries to connect to port 111 systemd will start rpcbind automaticly -+ run "service rpcbind status" 0 "stopping nfs should bring rpcbind up" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"restarting rpbind also restart the the nfs server" -+ run "systemctl reset-failed" 0 "workaround for failure of starting too often" -+ log "{Info} Starting rpcbind while nfs is stopped" -+ run "service nfs stop" -+ run "service nfs status" 3 "nfs should be stopped" -+ run "service rpcbind restart" -+ run "service nfs status" 3 "starting rpcbind should NOT bring nfs up" -+ -+ log "{Info} Starting rpcbind while nfs is active" -+ run "service nfs start" -+ run "service nfs status" 0 "nfs should be active" -+ run "service rpcbind restart" -+ run "service nfs status" 0 "starting rpcbind should NOT interfere nfs" -+ -+ log "{Info} Stopping rpcbind while nfs is active" -+ run "service nfs start" -+ run "service nfs status" 0 "nfs should be active" -+ run "service rpcbind start; service rpcbind stop" -+ run "service nfs status" 0 "stopping rpcbind should NOT bring nfs down" -+ -+ log "{Info} Stopping rpcbind while nfs is stopped" -+ run "service nfs stop" -+ run "service nfs status" 3 "nfs should be stopped" -+ run "service rpcbind start; service rpcbind stop" -+ run "service nfs status" 3 "stopping rpcbind should NOT interfere nfs" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-fix-long-nfsd-startup-delay-in-absence-of-rpcbind -+ run "systemctl stop rpcbind" -+ run "systemctl stop nfs-server" -+ run "systemctl mask rpcbind" 0 "Mask systemd service rpcbind.service" -+ run "timeLimitRun 10 systemctl start nfs-server" 1-255 "Start service nfs-server without rpcbind will be failed due to systemd unit dependency" -+ run "systemctl unmask rpcbind" -+ run "timeLimitRun 10 systemctl stop nfs-server" - -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"nfs-utils need to cause gssproxy reload" -+ run "cp /etc/gssproxy/gssproxy.conf /etc/gssproxy/gssproxy.conf.backup" 0 "backuping" -+ run "echo '[gssproxy]' > /etc/gssproxy/gssproxy.conf" -+ run "echo 'debug = true' >> /etc/gssproxy/gssproxy.conf" -+ run "systemctl restart gssproxy" -+#FIXME when BZ#1535424 is fixed. Should not use /var/log/messages as it is not used on Fedora any more. -+ run "echo '' > /var/log/messages" -+ run "systemctl restart nfs" -+ run "systemctl status nfs" -+ run "systemctl status gssproxy" -+ run "cat /var/log/messages | grep 'gssproxy:'" - -+ run "cat /var/log/messages | grep -q 'gssproxy:.*loaded'" 0 "should re-reading config" -+ run "mv /etc/gssproxy/gssproxy.conf.backup /etc/gssproxy/gssproxy.conf" 0 "recovering" -+ run "systemctl restart gssproxy" -+ rlPhaseEnd -+ -+ rlPhaseStartCleanup do-Cleanup- -+ run "userdel -rf testuserqa" - -+ rlFileRestore -+ run 'timeLimitRun 10 service_nfsconfig restart' -+ rlPhaseEnd -+ -+rlJournalEnd -+#rlJournalPrintText -+#enable_avc_check -diff --git a/tests/systemd-nfs/subtest.yml b/tests/systemd-nfs/subtest.yml -new file mode 100644 -index 0000000..705c8b0 ---- /dev/null -+++ b/tests/systemd-nfs/subtest.yml -@@ -0,0 +1,2 @@ -+attr: {ssched: yes.dangerous} -+attr: {ssched: yes.dangerous}, setup: [--kernel-options=ipv6.disable=1] -diff --git a/tests/tests.yml b/tests/tests.yml -new file mode 100644 -index 0000000..8b5bd0d ---- /dev/null -+++ b/tests/tests.yml -@@ -0,0 +1,20 @@ -+--- -+# Tests that run in classic context -+- hosts: localhost -+ roles: -+ - role: standard-test-rhts -+ use_beakerlib_libraries: yes -+ tags: -+ - classic -+ tests: -+ - exportfs -+ - export-mount-local -+ - mount -+ - nfs-mount-options-all -+ - systemd-nfs -+ - umount -+ required_packages: -+ - bind-utils # export-mount-local needs this package -+ - findutils # beakerlib needs find command -+ - nfs-utils -+ - redhat-lsb-core # lsb_release is needed by tests -diff --git a/tests/umount/PURPOSE b/tests/umount/PURPOSE -new file mode 100644 -index 0000000..9f896d5 ---- /dev/null -+++ b/tests/umount/PURPOSE -@@ -0,0 +1,2 @@ -+Description: Test for command umount.nfs{,4} -+Author: Stevens Yin -diff --git a/tests/umount/_env b/tests/umount/_env -new file mode 100644 -index 0000000..dd7d64f ---- /dev/null -+++ b/tests/umount/_env -@@ -0,0 +1,7 @@ -+export TOPLEVEL_NAMESPACE=nfs-utils -+export PKG_NAMESPACE=nfs-utils -+export RELATIVE_PATH=umount -+export PACKAGE=nfs-utils -+export PACKAGE_NAME=nfs-utils -+export PKG_LIST=nfs-utils nfs-utils-lib libnfsidmap libsss_idmap libtirpc rpcbind -+export TEST=/nfs-utils/umount -diff --git a/tests/umount/runtest.sh b/tests/umount/runtest.sh -new file mode 100644 -index 0000000..8dee5c7 ---- /dev/null -+++ b/tests/umount/runtest.sh -@@ -0,0 +1,122 @@ -+#!/bin/bash -+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: Test for command umount.nfs{,4} -+# Author: Stevens Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2013 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh -+. /usr/share/beakerlib/beakerlib.sh || exit 1 -+ -+#=============================================================================== -+ -+mnt=/nfs-mount -+expDir=/expDir -+prog=umount.nfs -+ -+rlJournalStart -+ rlPhaseStartSetup do-Setup -+ # Load beakerlib you needed -+ rlImport kernel/base -+ envinfo -+ read IP4 _nil <<<$(getDefaultIp) -+ rlFileBackup /etc/sysconfig/nfs /etc/exports -+ run "mkdir -p $mnt $expDir" -+ run "echo '$expDir *(rw,no_root_squash,fsid=0)' > /etc/exports" -+ run 'service_nfs restart' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-$prog-with-wrong-option -+ run "$prog -xxxx" 1-255 "should exit with an error code" -+ run "$prog -xxxx 2>&1 | egrep -i '(usage:|try.*for more info)'" 0 "should output usage to user" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-$prog-without-args -+ run "$prog" 1-255 "should exit with an error code" -+ run "$prog 2>&1 | egrep -i '(usage:|try.*for more info)'" 0 "should output usage to user" -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-$prog--h -+ run "$prog -h" - -+ std=$($prog -h 2>&1) -+ run "$prog -h 2>&1 | egrep -i usage:" -+ [ $? = 0 ] && { -+ options=$(echo "$std"|grep -o '\[-[a-z]\+\]') -+ [ ${#options} -gt 3 ] && { -+ optionNuma=$((${#options} - 3)) -+ optionNumb=$(echo "$std" | sed -n "/\t-$options/p" | wc -l) -+ optionNumc=$(echo "$std" | sed -n "/\t-[a-zA-Z]/p" | wc -l) -+ run "test $optionNuma = $optionNumb" -+ run "test $optionNuma = $optionNumc" -+ run 'echo "$std" | sed -n "/\t-$options/p" | grep " "' 1 -+ } -+ } -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-Cannot-umount-NFS-mp-with-spaces -+ serv=localhost -+ expdirWithSpaces="/expdir with spaces" -+ nfsmpWithSpaces="/mnt/nfsmp with spaces" -+ run 'mkdir -p "$expdirWithSpaces" "$nfsmpWithSpaces"' -+ run 'echo "\"$expdirWithSpaces\" *(rw,no_root_squash,fsid=0)" > /etc/exports' -+ run 'service_nfs restart' -+ run 'service_nfs restart 2>&1 | grep "expdir with spaces does not support"' 1 \ -+ "exportfs give incorrect message for mount dir containing spaces" -+ run 'mount -t nfs "$serv:$expdirWithSpaces" "$nfsmpWithSpaces"' 0 "mount dir with spaces" -+ run 'grep "$nfsmpWithSpaces" /proc/mounts' - -+ run 'umount "$nfsmpWithSpaces"' 0 "umount dir with spaces" -+ run 'grep "$nfsmpWithSpaces" /proc/mounts' 1 "cat /proc/mounts and umount successfully" -+ run 'rm -rf "$expdirWithSpaces" "$nfsmpWithSpaces"' -+ rlPhaseEnd -+ -+ rlPhaseStartTest do-Test-"[nfsv3] umount.nfs: Failed to find '' protocol" -+ log "{Info} Creating a small (separate) fs on a loopback device." -+ run "dd if=/dev/zero of=fs.img bs=1M count=1000" - -+ run "losetup /dev/loop0 fs.img" - -+ run "mkfs.ext4 /dev/loop0" - -+ run "mkdir $expDir/foo" -+ run "mount /dev/loop0 $expDir/foo" -+ log "{Info} Listing the contents of the directory to trigger a submount." -+ run "echo '$expDir *(crossmnt)' > /etc/exports" -+ run "service_nfs restart" -+ run "mount localhost:$expDir $mnt -o vers=3" -+ run "ls $mnt/foo" -+ run "cat /proc/mounts | grep $mnt" - -+ run "umount $mnt/foo &>stdout.log" -+ run "cat stdout.log" - -+ run "cat stdout.log | grep -q 'Failed'" 1 "should not output error msg" -+ run "umount $mnt" -+ log "{Info} Recovering it." -+ run "service_nfs stop" -+ run "umount $expDir/foo" -+ run "rm -rf $expDir/foo" -+ run "losetup -d /dev/loop0" - -+ run "rm -f fs.img" - -+ rlPhaseEnd -+ -+ rlPhaseStartCleanup do-Cleanup -+ rlFileRestore -+ rm -rf $mnt $expDir -+ rlPhaseEnd -+rlJournalEnd -+#rlJournalPrintText -+ - -From 5218121ee7e9c9ed75f3d1b91bae0b2a15f154b2 Mon Sep 17 00:00:00 2001 -From: Bruno Goncalves -Date: Jan 17 2019 20:02:54 +0000 -Subject: [PATCH 2/6] fixed some test issues - - ---- - -diff --git a/tests/exportfs/runtest.sh b/tests/exportfs/runtest.sh -index 8e34a8c..69d9532 100755 ---- a/tests/exportfs/runtest.sh -+++ b/tests/exportfs/runtest.sh -@@ -48,7 +48,7 @@ rlJournalStart - hostnamectl set-hostname exportfs.test - fi - #clean nfs garbage, avoid affect from pre case -- { exportfs -ua; service nfs stop &>/dev/null; } -+ { exportfs -ua; service_nfs stop &>/dev/null; } - rlFileBackup /etc/sysconfig/nfs /etc/exports - rlFileBackup --clean /etc/exports.d/ - run 'rm -f /etc/exports.d/*' -@@ -148,7 +148,7 @@ rlJournalStart - - rlPhaseStartTest do-Test-exportfs-when-/proc/fs/nfsd-not-mount - run 'mkdir -p ${expdir}_tmp' -- run 'service nfs start' -+ run 'service_nfs start' - run 'pkill rpc.mountd && umount /proc/fs/nfsd' - run 'exportfs -iv *:${expdir}_tmp' - run 'mount -t nfsd nfsd /proc/fs/nfsd' 0-255 "restore env: mount nfsd" -@@ -157,7 +157,7 @@ rlJournalStart - - rlPhaseStartTest do-Test-option-nordirplus - #nfsv3 export option nordirplus support test -- run 'service nfs start' -+ run 'service_nfs start' - run 'exportfs -i -o nordirplus "*:$expdir"' - run 'mount -o vers=3 localhost:$expdir $nfsmp' - run 'grep $nfsmp /proc/mounts' -diff --git a/tests/systemd-nfs/runtest.sh b/tests/systemd-nfs/runtest.sh -index 227ec36..63d8593 100755 ---- a/tests/systemd-nfs/runtest.sh -+++ b/tests/systemd-nfs/runtest.sh -@@ -38,7 +38,7 @@ cleanup() { - } - - #global var define --serv=nfs -+serv=nfs-server - rpm -q systemd || { - echo "{Warn} no systemd installed, skip the test" - report_result $TEST PASS -diff --git a/tests/tests.yml b/tests/tests.yml -index 8b5bd0d..865464b 100644 ---- a/tests/tests.yml -+++ b/tests/tests.yml -@@ -2,7 +2,7 @@ - # Tests that run in classic context - - hosts: localhost - roles: -- - role: standard-test-rhts -+ - role: standard-test-beakerlib - use_beakerlib_libraries: yes - tags: - - classic -@@ -16,5 +16,6 @@ - required_packages: - - bind-utils # export-mount-local needs this package - - findutils # beakerlib needs find command -+ - iptables # nfs-mount-options-all needs this package - - nfs-utils - - redhat-lsb-core # lsb_release is needed by tests - -From 69a4cec52d5d1803bfa88670501b4f8d1dcd9481 Mon Sep 17 00:00:00 2001 -From: Bruno Goncalves -Date: Jan 18 2019 17:24:32 +0000 -Subject: [PATCH 3/6] sync export-mount-local and systemd-nfs with tests from QE - - ---- - -diff --git a/tests/export-mount-local/Makefile b/tests/export-mount-local/Makefile -new file mode 100644 -index 0000000..6ddfa94 ---- /dev/null -+++ b/tests/export-mount-local/Makefile -@@ -0,0 +1,76 @@ -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: test for: export-mount -+# Author: Jianhong Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2014 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+#Generate and export TEST= PACKAGE= -+TENV=_env -+ifeq ($(PKG_TOP_DIR),) -+ export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ export _TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ -include $(PKG_TOP_DIR)/env.mk -+endif -+include $(TENV) -+ifeq ($(_TOP_DIR),) -+ _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) -+endif -+#=============================================================================== -+export TESTVERSION=1.0 -+ -+BUILT_FILES= -+FILES=$(TENV) $(METADATA) runtest.sh Makefile PURPOSE -+ -+.PHONY: all install download clean -+ -+run: $(FILES) build -+ ( set +o posix; [ -e /usr/bin/rhts_environment.sh ] && . /usr/bin/rhts_environment.sh; \ -+. /usr/share/beakerlib/beakerlib.sh || exit 1; \ -+. runtest.sh ) -+ -+build: $(BUILT_FILES) -+ test -x runtest.sh || chmod a+x runtest.sh -+ -+clean: -+ rm -f *~ $(BUILT_FILES) -+ -+-include /usr/share/rhts/lib/rhts-make.include -+ -+$(METADATA): Makefile -+ @echo "Owner: Jianhong Yin " > $(METADATA) -+ @echo "Name: $(TEST)" >> $(METADATA) -+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) -+ @echo "Path: $(TEST_DIR)" >> $(METADATA) -+ @echo "Description: test for: export-mount" >> $(METADATA) -+ @echo "Type: function" >> $(METADATA) -+ @echo "Type: $(PACKAGE)-level-tier1" >> $(METADATA) -+ @echo "TestTime: 30m" >> $(METADATA) -+ @echo "RunFor: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: $(PACKAGE)" >> $(METADATA) -+ @echo "Priority: Normal" >> $(METADATA) -+ @echo "License: GPLv2" >> $(METADATA) -+ @echo "Requires: library(kernel/base)" >> $(METADATA) -+ @echo "Requires: nfs-utils" >> $(METADATA) -+ @echo "Requires: bind-utils" >> $(METADATA) -+ @echo "RhtsRequires: library(kernel/base)" >> $(METADATA) -+ rhts-lint $(METADATA) -diff --git a/tests/export-mount-local/runtest.sh b/tests/export-mount-local/runtest.sh -index e72e0f4..60d0c90 100755 ---- a/tests/export-mount-local/runtest.sh -+++ b/tests/export-mount-local/runtest.sh -@@ -1,39 +1,43 @@ - #!/bin/bash - # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --# --# Description: test for: export-mount -+# Description: test for: export-mount-local - # Author: Jianhong Yin --# - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # - # Copyright (c) 2014 Red Hat, Inc. - # --# This program is free software: you can redistribute it and/or --# modify it under the terms of the GNU General Public License as --# published by the Free Software Foundation, either version 2 of --# the License, or (at your option) any later version. -+# This copyrighted material is made available to anyone wishing -+# to use, modify, copy, or redistribute it subject to the terms -+# and conditions of the GNU General Public License version 2. - # - # This program is distributed in the hope that it will be - # useful, but WITHOUT ANY WARRANTY; without even the implied - # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR --# PURPOSE. See the GNU General Public License for more details. -+# PURPOSE. See the GNU General Public License for more details. - # --# You should have received a copy of the GNU General Public License --# along with this program. If not, see http://www.gnu.org/licenses/. -+# You should have received a copy of the GNU General Public -+# License along with this program; if not, write to the Free -+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+# Boston, MA 02110-1301, USA. - # - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - [ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh - . /usr/share/beakerlib/beakerlib.sh || exit 1 - -+# Load beakerlib you needed -+rlImport kernel/base -+envinfo -+#disable_avc_check -+ - #=============================================================================== - - #signal trap - trap "cleanup" SIGINT SIGTERM SIGHUP SIGQUIT - cleanup() { -- rlFileRestore -- rm -rf $expdir $nfsmp -+ rlFileRestore -+ rm -rf $expdir $nfsmp - } - - #global var define -@@ -41,202 +45,180 @@ BZ=exp-mount-local - expdir=/exportDir-$BZ - nfsmp=/mnt/nfsmp-$BZ - subexpdir=/exportDir-$BZ/sub --tmpnfsmp=/tmp/nfsmp-$BZ -+tmpnfsmp=${nfsmp}-tmp - --host="$HOSTNAME" -+read ipv4 _nil <<<$(getDefaultIp) -+read ipv6s _nil <<<$(getDefaultIp 6) -+ipv6="[$ipv6s]" - # in case "localhost.localdomain" --echo "$host" | grep -q "localhost" && host="localhost" -+if echo "$HOSTNAME" | grep -q "localhost"; then -+ ORIGINAL_HOSTNAME="$HOSTNAME" -+ HOSTNAME="$BZ" -+ hostnamectl set-hostname "$HOSTNAME" -+fi -+host="$HOSTNAME" - - rlJournalStart - rlPhaseStartSetup do-Setup- -- # Load beakerlib you needed -- rlImport kernel/base -- read ipv4 _nil <<<$(getDefaultIp) -- read ipv6s _nil <<<$(getDefaultIp 6 global) -- ipv6="[$ipv6s]" -- envinfo -- rlFileBackup /etc/exports /etc/sysconfig/nfs /etc/nfs.conf /etc/hosts -- if [ "$host" = "localhost" ]; then -+ rlFileBackup /etc/{exports,auto.master} /etc/sysconfig/{nfs,autofs} /etc/nfs.conf /etc/hosts -+ if [ -n "ORIGINAL_HOSTNAME" ]; then - run "echo '$ipv4 $host' >> /etc/hosts" -- if [ -n "$ipv6s" ]; then -- run "echo '$ipv6s $host' >> /etc/hosts" -- fi -+ run "echo '$ipv6s $host' >> /etc/hosts" - run "cat /etc/hosts" - - fi -- run 'rm -rf $expdir $nfsmp && mkdir -p $expdir $nfsmp' -- run 'rm -rf $subexpdir $tmpnfsmp && mkdir -p $subexpdir $tmpnfsmp' -- run 'echo "/tmp *(ro,sync)" >/etc/exports' -- run 'service_nfs restart' -- #avoid issues restarting the server too quickly -- sleep 10 -- run 'ls_nfsvers' -+ run "rm -rf $expdir $nfsmp && mkdir -p $expdir $nfsmp" -+ run "rm -rf $subexpdir $tmpnfsmp && mkdir -p $subexpdir $tmpnfsmp" -+ run "service_nfs restart" -+ run "ls_nfsvers" - rlPhaseEnd - --for V in $(ls_nfsvers); do -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-ipv4 -- run "exportfs -au && exportfs -iv $ipv4:$expdir -o ro,sync,no_root_squash" -- run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -- run 'umount $nfsmp' -- rlPhaseEnd -- if [ -n "$ipv6s" ]; then -+ for V in $(ls_nfsvers); do -+ # export by IPv4 and try to mount it -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-ipv4 -+ run "exportfs -au && exportfs -iv $ipv4:$expdir -o ro,sync,no_root_squash" -+ run "mount -o vers=$V $ipv4:$expdir $nfsmp" -+ run "umount $nfsmp" -+ rlPhaseEnd - rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-ipv6-x -- run 'mount -o vers=$V $ipv6:$expdir $nfsmp' 1-255 -- [ $? = 0 ] && run "umount $nfsmp" -+ if [ -n "$ipv6s" ]; then -+ run "mount -o vers=$V $ipv6:$expdir $nfsmp" 1-255 -+ [ $? = 0 ] && run "umount $nfsmp" -+ fi -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-host-bz876847 -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "umount $nfsmp" - rlPhaseEnd -- fi -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-host -- run 'mount -o vers=$V $host:$expdir $nfsmp' -- run 'umount $nfsmp' -- rlPhaseEnd - -- if [ -n "$ipv6s" ]; then -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv6 -- run "exportfs -au && exportfs -iv $ipv6:$expdir -o ro,sync,no_root_squash" -- run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -- run 'umount $nfsmp' -+ if [ -n "$ipv6s" ]; then -+ # export by IPv6 and try to mount it -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv6 -+ run "exportfs -au && exportfs -iv $ipv6:$expdir -o ro,sync,no_root_squash" -+ run "mount -o vers=$V $ipv6:$expdir $nfsmp" -+ run "umount $nfsmp" -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv4-x -+ run "mount -o vers=$V $ipv4:$expdir $nfsmp" 1-255 -+ [ $? = 0 ] && run "umount $nfsmp" -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-host -+ run "dig -t aaaa $HOSTNAME +short" 0 "To get the IPv6 address" -+ if [ -n "$ipv6s" ]; then -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "umount $nfsmp" -+ fi -+ rlPhaseEnd -+ fi -+ -+ # export by hostname and try to mount it -+ rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-host -+ run "exportfs -au && exportfs -iv $host:$expdir -o ro,sync,no_root_squash" -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "umount $nfsmp" - rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv4-x -- run 'mount -o vers=$V $ipv4:$expdir $nfsmp' 1-255 -- [ $? = 0 ] && run "umount $nfsmp" -+ rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv4 -+ run "mount -o vers=$V $ipv4:$expdir $nfsmp" -+ run "umount $nfsmp" - rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-host -- if [ -n "$(dig -t aaaa $HOSTNAME +short)" ]; then -- run 'mount -o vers=$V $host:$expdir $nfsmp' -- run 'umount $nfsmp' -+ rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv6 -+ run "dig -t aaaa $HOSTNAME +short" 0 "To get the IPv6 address" -+ if [ -n "$ipv6s" ]; then -+ run "mount -o vers=$V $ipv6:$expdir $nfsmp" -+ run "umount $nfsmp" - fi - rlPhaseEnd -- fi - -- rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-host -- run "exportfs -au && exportfs -iv $host:$expdir -o ro,sync,no_root_squash" -- run 'mount -o vers=$V $host:$expdir $nfsmp' -- run 'umount $nfsmp' -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv4 -- run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -- run 'umount $nfsmp' -- rlPhaseEnd -- if [ -n "$ipv6s" ]; then -- rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv6 -- if [ -n "$(dig -t aaaa $HOSTNAME +short)" ]; then -- run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -- run 'umount $nfsmp' -+ # export sub-directory by IPv4 and try to mount it -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv4 -+ run "echo '$expdir *(ro,sync,no_root_squash)' >/etc/exports" -+ run "echo '$subexpdir $ipv4(ro,sync,no_root_squash)' >>/etc/exports" -+ which systemctl >/dev/null 2>&1 && run "systemctl reset-failed" -+ run "service_nfs restart" -+ run "showmount -e" - -+ run "mount -o vers=$V $ipv4:$expdir $nfsmp" -+ run "mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp" -+ run "umount $nfsmp $tmpnfsmp" -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv6-x-bz1198900 -+ if [ -n "$ipv6s" ]; then -+ run "mount -o vers=$V $ipv6:$expdir $nfsmp" -+ run "mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp" 1-255 "bz1198900 should not mount sub-directory with different ip" -+ [ $? = 0 ] && run "umount $tmpnfsmp" -+ run "umount $nfsmp" - fi - rlPhaseEnd -- fi -- -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv4 -- run 'echo "$expdir *(ro,sync,no_root_squash)" >/etc/exports' -- run 'echo "$subexpdir $ipv4(ro,sync,no_root_squash)" >>/etc/exports' -- run 'service_nfs restart' -- #avoid issues restarting the server too quickly -- sleep 10 -- run 'showmount -e' - -- run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -- run 'mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp' -- run 'umount $nfsmp $tmpnfsmp' -- rlPhaseEnd -- if [ -n "$ipv6s" ]; then -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv6-x -- run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -- run 'mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp' 1-255 "should not mount sub-directory with different ip" -- [ $? = 0 ] && run "umount $tmpnfsmp" -- run "umount $nfsmp" -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-host -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "mount -o vers=$V $host:$subexpdir $tmpnfsmp" -+ run "umount $nfsmp $tmpnfsmp" - rlPhaseEnd -- fi -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-host -- run 'mount -o vers=$V $host:$expdir $nfsmp' -- run 'mount -o vers=$V $host:$subexpdir $tmpnfsmp' -- run 'umount $nfsmp $tmpnfsmp' -- rlPhaseEnd - -- if [ -n "$ipv6s" ]; then -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv4-x -- run 'echo "$expdir *(ro,sync,no_root_squash)" >/etc/exports' -- run 'echo "$subexpdir $ipv6s(ro,sync,no_root_squash)" >>/etc/exports' -- run 'service_nfs restart' -- #avoid issues restarting the server too quickly -- sleep 10 -- run 'showmount -e' - -- run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -- run 'mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp' 1-255 "should not mount sub-directory with different ip" -- [ $? = 0 ] && run "umount $tmpnfsmp" -- run "umount $nfsmp" -+ if [ -n "$ipv6s" ]; then -+ # export sub-directory by IPv6 and try to mount it -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv4-x-bz1198900 -+ run "echo '$expdir *(ro,sync,no_root_squash)' >/etc/exports" -+ run "echo '$subexpdir $ipv6s(ro,sync,no_root_squash)' >>/etc/exports" -+ which systemctl >/dev/null 2>&1 && run "systemctl reset-failed" -+ run "service_nfs restart" -+ run "showmount -e" - -+ run "mount -o vers=$V $ipv4:$expdir $nfsmp" -+ run "mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp" 1-255 "bz1198900 should not mount sub-directory with different ip" -+ [ $? = 0 ] && run "umount $tmpnfsmp" -+ run "umount $nfsmp" -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv6 -+ run "mount -o vers=$V $ipv6:$expdir $nfsmp" -+ run "mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp" -+ run "umount $nfsmp $tmpnfsmp" -+ rlPhaseEnd -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-host -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "mount -o vers=$V $host:$subexpdir $tmpnfsmp" -+ run "umount $nfsmp $tmpnfsmp" -+ rlPhaseEnd -+ fi -+ -+ # export sub-directory by hostname and try to mount it -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv4 -+ run "echo '$expdir *(ro,sync,no_root_squash)' >/etc/exports" -+ run "echo '$subexpdir $host(ro,sync,no_root_squash)' >>/etc/exports" -+ which systemctl >/dev/null 2>&1 && run "systemctl reset-failed" -+ run "service_nfs restart" -+ run "showmount -e" - -+ run "mount -o vers=$V $ipv4:$expdir $nfsmp" -+ run "mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp" -+ run "umount $nfsmp $tmpnfsmp" - rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv6 -- run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -- run 'mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp' -- run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv6 -+ if [ -n "$ipv6s" ]; then -+ run "mount -o vers=$V $ipv6:$expdir $nfsmp" -+ run "mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp" -+ run "umount $nfsmp $tmpnfsmp" -+ fi - rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-host -- run 'mount -o vers=$V $host:$expdir $nfsmp' -- run 'mount -o vers=$V $host:$subexpdir $tmpnfsmp' -- run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-host -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "mount -o vers=$V $host:$subexpdir $tmpnfsmp" -+ run "umount $nfsmp $tmpnfsmp" - rlPhaseEnd -- fi - -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv4 -- run 'echo "$expdir *(ro,sync,no_root_squash)" >/etc/exports' -- run 'echo "$subexpdir $host(ro,sync,no_root_squash)" >>/etc/exports' -- run 'service_nfs restart' -- #avoid issues restarting the server too quickly -- sleep 10 -- run 'showmount -e' - -- run 'mount -o vers=$V $ipv4:$expdir $nfsmp' -- run 'mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp' -- run 'umount $nfsmp $tmpnfsmp' -- rlPhaseEnd -- if [ -n "$ipv6s" ]; then -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv6 -- run 'mount -o vers=$V $ipv6:$expdir $nfsmp' -- run 'mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp' -- run 'umount $nfsmp $tmpnfsmp' -+ rlPhaseStartTest do-Test-nfsV$V-default-option-overridden-by-client-specific-option -+ run "echo '$expdir -ro,sync *(rw,no_root_squash)' >/etc/exports" -+ run "service_nfs restart" -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "exports option should be overridden by client specific." -+ run "rm -rf $nfsmp/test*" -+ run "umount $nfsmp" -+ run "echo '$expdir -ro,sec=sys,sync *(rw,no_root_squash)' >/etc/exports" 0 "sec=sys may cause it to be failed." -+ run "exportfs -rv" -+ run "mount -o vers=$V $host:$expdir $nfsmp" -+ run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "bz1359042 exports option should be overridden by client specific." -+ run "rm -rf $nfsmp/test*" -+ run "umount $nfsmp" - rlPhaseEnd -- fi -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-host -- run 'mount -o vers=$V $host:$expdir $nfsmp' -- run 'mount -o vers=$V $host:$subexpdir $tmpnfsmp' -- run 'umount $nfsmp $tmpnfsmp' -- rlPhaseEnd -- -- rlPhaseStartTest do-Test-nfsV$V-default-option-overridden-by-client-specific-option -- run "echo '$expdir -ro,sync *(rw,no_root_squash)' >/etc/exports" -- run "service_nfs restart" -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "exports option should be overridden by client specific." -- run "rm -rf $nfsmp/test*" -- run "umount $nfsmp" -- run "echo '$expdir -ro,sec=sys,sync *(rw,no_root_squash)' >/etc/exports" 0 "sec=sys may cause it to be failed." -- run "exportfs -rv" -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "exports option should be overridden by client specific." -- run "rm -rf $nfsmp/test*" -- run "umount $nfsmp" -- rlPhaseEnd --done -+ done - -- rlPhaseStartTest do-Test-exports-options-twice -- run 'echo "/ *(sync,hide,no_wdelay)" > /etc/exports' -- run "service_nfs restart" -- #avoid issues restarting the server too quickly -- sleep 10 -- -- # Count all options from list printed by exportfs -s(rhel-7) or exportfs -v(rhel-6) -- allOptions=$( (exportfs -s 2>/dev/null || exportfs -v) | sed 's/^.*(//;s/)$//;s/,/\n/g' | wc -l) -- # Count unique options from list printed by exportfs -s(rhel-7) or exportfs -v(rhel-6) -- uniqOptions=$( (exportfs -s 2>/dev/null || exportfs -v) | sed 's/^.*(//;s/)$//;s/,/\n/g' | sort | uniq | wc -l) -- -- log "{Info} exportfs -s(rhel-7) or exportfs -v(rhel-6) will print option list for each export path" -- log "{Info} All options printed by exportfs -s(rhel-7) or exportfs -v(rhel-6) (sorted):" -- run "(exportfs -s 2>/dev/null || exportfs -v) | sed 's/^.*(//;s/)$//;s/,/\n/g' | sort" -- log "{Info} For exported path '/', there are $allOptions options printed in all options list and $uniqOptions of them are unique" -- run 'test $uniqOptions -eq $allOptions' 0 "Should not output any options twice, quantity of all options should be equal to quantity of unique options" -- for opt in sync hide no_wdelay; do -- run "(exportfs -s 2>/dev/null || exportfs -v) | grep -q $opt" 0 "Option list should contain option $opt specified in /etc/exports" -- done -- rlPhaseEnd -- -- rlPhaseStartTest do-Test-server-side-using-bind-mount -+ rlPhaseStartTest do-Test-bz1479135-server-side-using-bind-mount - run "dd if=/dev/zero of=workspace.image bs=3M count=500" - run "mkfs -t ext3 -F workspace.image" - run "mkdir -p /workspace" -@@ -247,8 +229,6 @@ done - run "echo '/srv/nfs/vmcore *(rw,no_root_squash)' > /etc/exports" - run "echo '/workspace *(rw,no_root_squash)' >> /etc/exports" - run "service_nfs restart" -- #avoid issues restarting the server too quickly -- sleep 10 - run "mount $host:/workspace $nfsmp" - run "ls $nfsmp/work_dir" - run "umount $nfsmp" -@@ -259,45 +239,103 @@ done - run "rm workspace.image" - rlPhaseEnd - -- rlPhaseStartTest do-Test-mount-nfsv4-show-wrong-port -- run "echo '$expdir *(rw,no_root_squash)' >>/etc/exports" -- run "service_nfs restart" -- #avoid issues restarting the server too quickly -- sleep 10 -- run "exportfs -v" -- run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" -- run "mount -t nfs4 | grep $nfsmp" - -- run "mount -t nfs4 | grep $nfsmp | grep -q port=2049" 0 "Should show port=2049" -- run "umount $nfsmp" -- run "echo '[nfsd]' > /etc/nfs.conf" -- run "echo 'port=20050' >> /etc/nfs.conf" -- run "service_nfs restart" -- run "sleep 10" -- run "rpcinfo -p | grep -w nfs | grep 20050" -- run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" - -- if [ $? -eq 0 ]; then -- run "mount -t nfs4" - -- run "mount -t nfs4 | grep -q port=20050" 0 "Should show port=20050" -- run "umount $nfsmp" -- fi -- run "mount -t nfs -o vers=4,port=0 localhost:$expdir $nfsmp" - -- if [ $? -eq 0 ]; then -- run "mount -t nfs4" - -- run "mount -t nfs4 | grep -q port=20050" 0 "Should show port=20050" -- run "umount $nfsmp" -- fi -- run "mount -t nfs -o vers=4,port=20050 localhost:$expdir $nfsmp" -- run "mount -t nfs4 | grep $nfsmp" - -- run "mount -t nfs4 | grep $nfsmp | grep -q port=20050" 0 "Should show port=20050" -- run "umount $nfsmp" -+ rlPhaseStartTest do-Test-bz1465259-mount-nfsv4-show-wrong-port -+ run "echo '$expdir *(rw,no_root_squash)' > /etc/exports" -+ run "service_nfs restart" -+ run "exportfs -v" -+ run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "cat /proc/mounts | grep $nfsmp | grep -q 'port='" 1 "Omit displaying 'port=' by default" -+ run "mount -o remount,ro $nfsmp" -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "cat /proc/mounts | grep $nfsmp | grep -q 'port='" 1 "Omit displaying 'port=' by default" -+ run "umount $nfsmp" -+ if [ -e "/etc/nfs.conf" ]; then -+ echo "[nfsd]" > /etc/nfs.conf -+ echo "port=20050" >> /etc/nfs.conf -+ run "cat /etc/nfs.conf" - -+ run "service_nfs restart" -+ run "sleep 10" -+ run "rpcinfo -p | grep -w nfs | grep 20050" -+ run "mount -t nfs4 -o port=20050 localhost:$expdir $nfsmp" -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "cat /proc/mounts | grep $nfsmp | grep -q port=20050" 0 "Should show port=20050" -+ run "mount -o remount,ro $nfsmp" -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "cat /proc/mounts | grep $nfsmp | grep -q port=20050" 0 "Should show port=20050" -+ run "umount $nfsmp" -+ fi -+ log "{Info} If NFS service is not available on the specified port" -+ run "mount -t nfs4 -o port=2049 localhost:$expdir $nfsmp" 1-255 -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "umount $nfsmp" -+ fi -+ log "{Info} If port value is not specified" -+ if ls_nfsvers | grep -q -w 3; then -+ run "mount -t nfs -o vers=3 localhost:$expdir $nfsmp" 0 "for v2/v3 client uses port advertised by server's rpcbind service" -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "umount $nfsmp" -+ fi -+ run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" 1-255 "for v4 client uses the standard NFS port (2049) without checking" -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "umount $nfsmp" -+ fi -+ log "{Info} If the specified port value is 0" -+ run "mount -t nfs -o vers=4,port=0 localhost:$expdir $nfsmp" -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "cat /proc/mounts | grep $nfsmp | grep -q port=0" 0 "Should show port=0" -+ run "umount $nfsmp" -+ fi -+ run "echo '' > /etc/nfs.conf" 0 "Recovering" -+ fi - rlPhaseEnd - -+ if ls_nfsvers | grep -q -w "4.0"; then -+ rlPhaseStartTest do-Test-bz1592915-sanity-check-clientaddr-during-mount -+ run "echo '$expdir *(rw,no_root_squash)' > /etc/exports" -+ run "service_nfs restart" -+ run "exportfs -v" -+ log "{Info} Mounting v4.0 by default" -+ run "mount -o vers=4,minorversion=0 localhost:$expdir $nfsmp -v" -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "umount $nfsmp" -+ fi -+ log "{Info} Setting 'clientaddr=' not match any local address" -+ # use normal mode (no verbose) to check the emitted warning -+ run "mount -o vers=4,minorversion=0,clientaddr=1.2.3.4 localhost:$expdir $nfsmp &> >(tee stdout.log)" -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "umount $nfsmp" -+ fi -+ run "cat stdout.log | grep -q '[warning].*not match any existing network addresses'" 0 "Should warn the administrators" -+ log "{Info} Specifying IPv4_ANY (0.0.0.0) signifying client does not want delegations" -+ run "mount -o vers=4,minorversion=0,clientaddr=0.0.0.0 localhost:$expdir $nfsmp -v" -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "umount $nfsmp" -+ fi -+ log "{Info} Specifying IPv6_ANY (::0) signifying client does not want delegations" -+ run "mount -o vers=4,minorversion=0,clientaddr=::0 localhost:$expdir $nfsmp -v" -+ if [ $? -eq 0 ]; then -+ run "cat /proc/mounts | grep $nfsmp" - -+ run "umount $nfsmp" -+ fi -+ rlPhaseEnd -+ fi -+ - rlPhaseStartCleanup do-Cleanup- -- run 'rm -rf $expdir $nfsmp $subexpdir $tmpnfsmp' -+ run "rm -rf $expdir $nfsmp $subexpdir $tmpnfsmp" - rlFileRestore - run "service_nfs restart" -- #avoid issues restarting the server too quickly -- sleep 10 -+ if [ -n "ORIGINAL_HOSTNAME" ]; then -+ HOSTNAME="$ORIGINAL_HOSTNAME" -+ hostnamectl set-hostname "$HOSTNAME" -+ fi - rlPhaseEnd - rlJournalEnd - #rlJournalPrintText -diff --git a/tests/exportfs/Makefile b/tests/exportfs/Makefile -new file mode 100644 -index 0000000..d367651 ---- /dev/null -+++ b/tests/exportfs/Makefile -@@ -0,0 +1,79 @@ -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: test for command exportfs -+# Author: Stevens Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2013 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+TENV=_env -+ifeq ($(PKG_TOP_DIR),) -+ export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ export _TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ -include $(PKG_TOP_DIR)/env.mk -+endif -+include $(TENV) -+ifeq ($(_TOP_DIR),) -+ _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) -+endif -+#=============================================================================== -+ -+export TESTVERSION=1.0 -+ -+BUILT_FILES= -+ -+FILES=$(TENV) $(METADATA) runtest.sh Makefile PURPOSE -+ -+.PHONY: all install download clean -+ -+run: $(FILES) build -+ ( set +o posix; [ -e /usr/bin/rhts_environment.sh ] && . /usr/bin/rhts_environment.sh; \ -+. /usr/share/beakerlib/beakerlib.sh; \ -+. runtest.sh ) -+ -+build: $(BUILT_FILES) -+ test -x runtest.sh || chmod a+x runtest.sh -+ -+clean: -+ rm -f *~ $(BUILT_FILES) -+ -+ -+-include /usr/share/rhts/lib/rhts-make.include -+ -+$(METADATA): Makefile -+ @echo "Owner: Stevens Yin " > $(METADATA) -+ @echo "Name: $(TEST)" >> $(METADATA) -+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) -+ @echo "Path: $(TEST_DIR)" >> $(METADATA) -+ @echo "Description: test for command exportfs" >> $(METADATA) -+ @echo "Type: Regression" >> $(METADATA) -+ @echo "TestTime: 30m" >> $(METADATA) -+ @echo "RunFor: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: library(kernel/base)" >> $(METADATA) -+ @echo "RhtsRequires: library(kernel/base)" >> $(METADATA) -+ @echo "Priority: Normal" >> $(METADATA) -+ @echo "License: GPLv2" >> $(METADATA) -+ @echo "Confidential: no" >> $(METADATA) -+ @echo "Destructive: no" >> $(METADATA) -+ -+ rhts-lint $(METADATA) -+ -diff --git a/tests/mount/Makefile b/tests/mount/Makefile -new file mode 100644 -index 0000000..412b640 ---- /dev/null -+++ b/tests/mount/Makefile -@@ -0,0 +1,79 @@ -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: Test for command mount.nfs{,4} -+# Author: Stevens Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2013 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+TENV=_env -+ifeq ($(PKG_TOP_DIR),) -+ export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ export _TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ -include $(PKG_TOP_DIR)/env.mk -+endif -+include $(TENV) -+ifeq ($(_TOP_DIR),) -+ _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) -+endif -+#=============================================================================== -+ -+export TESTVERSION=1.0 -+ -+BUILT_FILES= -+ -+FILES=$(TENV) $(METADATA) runtest.sh Makefile PURPOSE -+ -+.PHONY: all install download clean -+ -+run: $(FILES) build -+ ( set +o posix; [ -e /usr/bin/rhts_environment.sh ] && . /usr/bin/rhts_environment.sh; \ -+. /usr/share/beakerlib/beakerlib.sh; \ -+. runtest.sh ) -+ -+build: $(BUILT_FILES) -+ test -x runtest.sh || chmod a+x runtest.sh -+ -+clean: -+ rm -f *~ $(BUILT_FILES) -+ -+ -+-include /usr/share/rhts/lib/rhts-make.include -+ -+$(METADATA): Makefile -+ @echo "Owner: Stevens Yin " > $(METADATA) -+ @echo "Name: $(TEST)" >> $(METADATA) -+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) -+ @echo "Path: $(TEST_DIR)" >> $(METADATA) -+ @echo "Description: Test for command mount.nfs{,4}" >> $(METADATA) -+ @echo "Type: Regression" >> $(METADATA) -+ @echo "TestTime: 30m" >> $(METADATA) -+ @echo "RunFor: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: library(kernel/base)" >> $(METADATA) -+ @echo "RhtsRequires: library(kernel/base)" >> $(METADATA) -+ @echo "Priority: Normal" >> $(METADATA) -+ @echo "License: GPLv2" >> $(METADATA) -+ @echo "Confidential: no" >> $(METADATA) -+ @echo "Destructive: no" >> $(METADATA) -+ -+ rhts-lint $(METADATA) -+ -diff --git a/tests/nfs-mount-options-all/Makefile b/tests/nfs-mount-options-all/Makefile -new file mode 100644 -index 0000000..afc24cc ---- /dev/null -+++ b/tests/nfs-mount-options-all/Makefile -@@ -0,0 +1,77 @@ -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: Test for nfs mount options -+# Author: Bill Peck -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2006 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+TENV=_env -+ifeq ($(PKG_TOP_DIR),) -+ export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ export _TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ -include $(PKG_TOP_DIR)/env.mk -+endif -+include $(TENV) -+ifeq ($(_TOP_DIR),) -+ _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) -+endif -+#=============================================================================== -+ -+ -+export TESTVERSION=0.1 -+ -+.PHONY: all install download clean -+ -+METADATA=testinfo.desc -+BUILT_FILES= # built executables should be added here -+FILES=$(TENV) $(METADATA) runtest.sh Makefile -+ -+build: $(BUILT_FILES) -+ chmod a+x ./runtest.sh -+ -+clean: -+ rm -f .*.swp *~ $(BUILT_FILES) -+ -+run: $(FILES) build -+ ( set +o posix; [ -e /usr/bin/rhts_environment.sh ] && . /usr/bin/rhts_environment.sh; \ -+. /usr/share/beakerlib/beakerlib.sh; \ -+. runtest.sh ) -+ -+-include /usr/share/rhts/lib/rhts-make.include -+# Generate the testinfo.desc here: -+$(METADATA): Makefile -+ @touch $(METADATA) -+ @echo "Owner: Nicol TAO" > $(METADATA) -+ @echo "Name: $(TEST)" >> $(METADATA) -+ @echo "Path: $(TEST_DIR)" >> $(METADATA) -+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) -+ @echo "Description: nfs general mount options supported by all nfs versions" >> $(METADATA) -+ @echo "TestTime: 45m" >> $(METADATA) -+ @echo "RunFor: $(PACKAGE_NAME)" >> $(METADATA) -+ @echo "RunFor: nfs-utils" >> $(METADATA) -+ @echo "Requires: $(PACKAGE_NAME)" >> $(METADATA) -+ @echo "Requires: library(kernel/base)" >> $(METADATA) -+ @echo "Requires: nfs-utils" >> $(METADATA) -+ @echo "RhtsRequires: library(kernel/base)" >> $(METADATA) -+ @echo "Priority: Medium" >> $(METADATA) -+ @echo "Type: Regression" >> $(METADATA) -+ @echo "License: GPL" >> $(METADATA) -diff --git a/tests/systemd-nfs/Makefile b/tests/systemd-nfs/Makefile -new file mode 100644 -index 0000000..111c1fc ---- /dev/null -+++ b/tests/systemd-nfs/Makefile -@@ -0,0 +1,74 @@ -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: test for: nfs -+# Author: Jianhong Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2014 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+#Generate and export TEST= PACKAGE= -+TENV=_env -+ifeq ($(PKG_TOP_DIR),) -+ export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ export _TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ -include $(PKG_TOP_DIR)/env.mk -+endif -+include $(TENV) -+ifeq ($(_TOP_DIR),) -+ _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) -+endif -+#=============================================================================== -+export TESTVERSION=1.0 -+ -+BUILT_FILES= -+FILES=$(TENV) $(METADATA) runtest.sh Makefile PURPOSE -+ -+.PHONY: all install download clean -+ -+run: $(FILES) build -+ ( set +o posix; [ -e /usr/bin/rhts_environment.sh ] && . /usr/bin/rhts_environment.sh; \ -+. /usr/share/beakerlib/beakerlib.sh || exit 1; \ -+. runtest.sh ) -+ -+build: $(BUILT_FILES) -+ test -x runtest.sh || chmod a+x runtest.sh -+ -+clean: -+ rm -f *~ $(BUILT_FILES) -+ -+-include /usr/share/rhts/lib/rhts-make.include -+ -+$(METADATA): Makefile -+ @echo "Owner: Jianhong Yin " > $(METADATA) -+ @echo "Name: $(TEST)" >> $(METADATA) -+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) -+ @echo "Path: $(TEST_DIR)" >> $(METADATA) -+ @echo "Description: test for: nfs" >> $(METADATA) -+ @echo "Type: regression" >> $(METADATA) -+ @echo "Type: $(PACKAGE)-level-tier1" >> $(METADATA) -+ @echo "TestTime: 30m" >> $(METADATA) -+ @echo "RunFor: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: $(PACKAGE)" >> $(METADATA) -+ @echo "Priority: Normal" >> $(METADATA) -+ @echo "License: GPLv2" >> $(METADATA) -+ @echo "Requires: nfs-utils" >> $(METADATA) -+ @echo "RhtsRequires: library(kernel/base)" >> $(METADATA) -+ rhts-lint $(METADATA) -diff --git a/tests/systemd-nfs/runtest.sh b/tests/systemd-nfs/runtest.sh -old mode 100755 -new mode 100644 -index 63d8593..ec2d219 ---- a/tests/systemd-nfs/runtest.sh -+++ b/tests/systemd-nfs/runtest.sh -@@ -1,40 +1,44 @@ - #!/bin/bash - # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --# - # Description: test for: nfs - # Author: Jianhong Yin --# - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # - # Copyright (c) 2014 Red Hat, Inc. - # --# This program is free software: you can redistribute it and/or --# modify it under the terms of the GNU General Public License as --# published by the Free Software Foundation, either version 2 of --# the License, or (at your option) any later version. -+# This copyrighted material is made available to anyone wishing -+# to use, modify, copy, or redistribute it subject to the terms -+# and conditions of the GNU General Public License version 2. - # - # This program is distributed in the hope that it will be - # useful, but WITHOUT ANY WARRANTY; without even the implied - # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR --# PURPOSE. See the GNU General Public License for more details. -+# PURPOSE. See the GNU General Public License for more details. - # --# You should have received a copy of the GNU General Public License --# along with this program. If not, see http://www.gnu.org/licenses/. -+# You should have received a copy of the GNU General Public -+# License along with this program; if not, write to the Free -+# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+# Boston, MA 02110-1301, USA. - # - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - [ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh - . /usr/share/beakerlib/beakerlib.sh || exit 1 - -+# Load beakerlib you needed -+rlImport kernel/base -+envinfo -+#disable_avc_check - #=============================================================================== - - #signal trap - trap "cleanup" SIGINT SIGTERM SIGHUP SIGQUIT - cleanup() { - rlFileRestore -- run 'service_nfsconfig restart' -- #rm -rf $expdir $nfsmp -+ run 'service_nfs restart' -+ run 'service_nfsconfig status &>/dev/null && service_nfsconfig restart' - -+ run 'userdel -rf testuserqa' - - } - - #global var define -@@ -47,135 +51,152 @@ rpm -q systemd || { - - rlJournalStart - rlPhaseStartSetup do-Setup- -- # Load beakerlib you needed -- rlImport kernel/base -- envinfo - rlFileBackup /etc/exports /etc/sysconfig/nfs - run 'echo "/usr/share *(ro)" >/etc/exports' -- run 'echo "RPCNFSDARGS=8" >/etc/sysconfig/nfs' 0 "avoid invalid config file" -- run 'service_nfsconfig restart' 0 "RHEL-7.1 or later need restart nfs-config to reload /etc/sysconfig/nfs" -+ run 'echo "" > /etc/sysconfig/nfs' 0 "avoid invalid config file" -+ # If in RHEL-7.1 or later need restart nfs-config service to flush /etc/sysconfig/nfs to /run/sysconfig/nfs-utils -+ # But since RHEL-7.3, nfs-config change to be ru-run during the dependent service starting -+ run 'service_nfsconfig status &>/dev/null && service_nfsconfig restart' - - run "useradd testuserqa" - - rlPhaseEnd - - rlPhaseStartTest do-Test-start -- run "service_$serv start" 0 "Service must start without problem" -- run "service_$serv status" 0 "Then Status command" -- run "service_$serv start" 0 "Already started service" -- run "service_$serv status" 0 "Again status command" -+ run "service_nfs start" 0 "Service must start without problem" -+ run "service_nfs status" 0 "Then Status command" -+ run "service_nfs start" 0 "Already started service" -+ run "service_nfs status" 0 "Again status command" - rlPhaseEnd - - rlPhaseStartTest do-Test-restart -- run "service_$serv restart" 0 "Restarting of service" -- run "service_$serv status" 0 "Status command" -+ run "service_nfs restart" 0 "Restarting of service" -+ run "service_nfs status" 0 "Status command" - rlPhaseEnd - - rlPhaseStartTest do-Test-stop -- run "service_$serv stop" 0 "Stopping service" -- run "service_$serv status" 3 "Status of stopped service" -- run "service_$serv stop" 0 "Stopping service again" -- run "service_$serv status" 3 "Status of stopped service" -+ run "service_nfs stop" 0 "Stopping service" -+ run "service_nfs status" 3 "Status of stopped service" -+ run "service_nfs stop" 0 "Stopping service again" -+ run "service_nfs status" 3 "Status of stopped service" - rlPhaseEnd - - rlPhaseStartTest do-Test-"insufficient-rights" -- run "service_$serv restart " 0 "Starting service for restarting under nonpriv user" -- run "su testuserqa -c 'service_$serv stop'" 1,4 "Insufficient rights, stopping service under nonprivileged user must fail" -- run "su testuserqa -c 'service_$serv start'" 0,1,4 "Insufficient rights, starting service under nonprivileged user must fail or pass as already started" -- run "su testuserqa -c 'service_$serv status'" 0 "Sufficient rights, service status should be accessible to nonprivileged users" -- run "service_$serv stop" 0 "Stopping service for starting under nonpriv user" -- run "su testuserqa -c 'service_$serv start'" 1,4 "Insufficient rights, starting of stopped service under nonprivileged user must fail" -+ run "service_nfs restart " 0 "Starting service for restarting under nonpriv user" -+ run "su testuserqa -c 'service_nfs stop'" 1,4 "Insufficient rights, stopping service under nonprivileged user must fail" -+ run "su testuserqa -c 'service_nfs start'" 0,1,4 "Insufficient rights, starting service under nonprivileged user must fail or pass as already started" -+ run "su testuserqa -c 'service_nfs status'" 0 "Sufficient rights, service status should be accessible to nonprivileged users" -+ run "service_nfs stop" 0 "Stopping service for starting under nonpriv user" -+ run "su testuserqa -c 'service_nfs start'" 1,4 "Insufficient rights, starting of stopped service under nonprivileged user must fail" - rlPhaseEnd - - rlPhaseStartTest do-Test-"operations" -- run "service_$serv start" 0 "Service have to implement start function" -- run 'sleep 5' 0 "sleep a while avoid the start rate limit" -- run "service_$serv restart" 0 "Service have to implement restart function" -- run "service_$serv status" 0 "Service have to implement status function" -- run 'sleep 5' 0 "sleep a while avoid the start rate limit" -- run "service_$serv condrestart" 0 "Service have to implement condrestart function" -+ run "service_nfs start" 0 "Service have to implement start function" -+ run 'sleep 5' 0 "sleep a while avoid the start rate limit, bz1160506" -+ run "service_nfs restart" 0 "Service have to implement restart function" -+ run "service_nfs status" 0 "Service have to implement status function" -+ run 'sleep 5' 0 "sleep a while avoid the start rate limit, bz1160506" -+ run "service_nfs condrestart" 0 "Service have to implement condrestart function" - [ $? != 0 ] && run "journalctl -xn" - -- run 'sleep 5' 0 "sleep a while avoid the start rate limit" -- run "service_$serv try-restart" 0 "Service have to implement try-restart function" -+ run 'sleep 5' 0 "sleep a while avoid the start rate limit, bz1160506" -+ run "service_nfs try-restart" 0 "Service have to implement try-restart function" - [ $? != 0 ] && run "journalctl -xn" - -- run "service_$serv reload" 0 "Service have to implement reload function" -+ run "service_nfs reload" 0 "Service have to implement reload function" - [ $? != 0 ] && run "journalctl -xn" - -- run "service_$serv force-reload" 0 "Service have to implement force-reload function" -+ run "service_nfs force-reload" 0 "Service have to implement force-reload function" - [ $? != 0 ] && run "journalctl -xn" - -- run "service_$serv noexistop" 2 "Testing proper return code when nonexisting function" -+ run "service_nfs noexistop" 2 "Testing proper return code when nonexisting function" - rlPhaseEnd - - # Should do nothing if a service is already stopped or not running (according to manpage of systemctl) - # http://refspecs.linuxbase.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic.html#INISCRPTACT - rlPhaseStartTest do-Test-"operations-stopped" -- run "service_$serv stop" 0 "Service have to implement stop function" -- run "service_$serv condrestart" 0 "Service have to implement condrestart function" -- run "service_$serv try-restart" 0 "Service have to implement try-restart function" -- run "service_$serv force-reload" 0 "Service have to implement force-reload function" -- run "service_$serv status" 3 "Above oprations should do nothing if service are not running" -+ run "service_nfs stop" 0 "Service have to implement stop function" -+ run "service_nfs condrestart" 0 "Service have to implement condrestart function" -+ run "service_nfs try-restart" 0 "Service have to implement try-restart function" -+ run "service_nfs force-reload" 0 "Service have to implement force-reload function" -+ run "service_nfs status" 3 "Above oprations should do nothing if service are not running" - rlPhaseEnd - - rlPhaseStartTest do-Test-enable-disable-$serv - if systemctl --quiet is-enabled $serv; then - run "systemctl disable $serv" 0 "Disable service on boot" - run "systemctl is-enabled $serv" 1 "Check whether service is disabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "test `systemctl is-enabled nfs-server` = disabled" - run "systemctl enable $serv" 0 "Enable service on boot" - run "systemctl is-enabled $serv" 0 "Check whether service is enabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "test `systemctl is-enabled nfs-server` = enabled" - else - run "systemctl enable $serv" 0 "Enable service on boot" - run "systemctl is-enabled $serv" 0 "Check whether service is enabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "test `systemctl is-enabled nfs-server` = enabled" - run "systemctl disable $serv" 0 "Disable service on boot" - run "systemctl is-enabled $serv" 1 "Check whether service is disabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "test `systemctl is-enabled nfs-server` = disabled" - fi - rlPhaseEnd - -- # ystemctl enable fails for symlinks in /usr/lib/systemd/system -+ # As Bug 1159308 - systemctl enable fails for symlinks in /usr/lib/systemd/system - # Use a workaround to test enable/disable with nfs-server.service -- rlPhaseStartTest do-Test-enable-disable-nfs-server -+ if [ -f /usr/lib/systemd/system/nfs.service ]; then -+ rlPhaseStartTest do-Test-enable-disable-nfs-symlinks - if systemctl --quiet is-enabled nfs-server; then -- run "systemctl disable nfs-server" 0 "Disable nfs-serverice on boot" -- run "systemctl is-enabled nfs-server" 1 "Check whether nfs-serverice is disabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -- run "systemctl enable nfs-server" 0 "Enable nfs-serverice on boot" -- run "systemctl is-enabled nfs-server" 0 "Check whether nfs-serverice is enabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "systemctl disable nfs" 0 "Disable nfs on boot" -+ run "systemctl is-enabled nfs" 1 "Check whether nfs is disabled" -+ run "test `systemctl is-enabled nfs` = `systemctl is-enabled nfs-server`" -+ run "systemctl enable nfs" 0 "Enable nfs on boot" -+ run "systemctl is-enabled nfs" 0 "Check whether nfs is enabled" -+ run "test `systemctl is-enabled nfs` = `systemctl is-enabled nfs-server`" - else -- run "systemctl enable nfs-server" 0 "Enable nfs-serverice on boot" -- run "systemctl is-enabled nfs-server" 0 "Check whether nfs-serverice is enabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -- run "systemctl disable nfs-server" 0 "Disable nfs-serverice on boot" -- run "systemctl is-enabled nfs-server" 1 "Check whether nfs-serverice is disabled" -- run "test `systemctl is-enabled nfs-server` = `systemctl is-enabled nfs`" -+ run "systemctl enable nfs" 0 "Enable nfs on boot" -+ run "systemctl is-enabled nfs" 0 "Check whether nfs is enabled" -+ run "test `systemctl is-enabled nfs` = `systemctl is-enabled nfs-server`" -+ run "systemctl disable nfs" 0 "Disable nfs on boot" -+ run "systemctl is-enabled nfs" 1 "Check whether nfs is disabled" -+ run "test `systemctl is-enabled nfs` = `systemctl is-enabled nfs-server`" - fi - rlPhaseEnd -+ fi - -- rlPhaseStartTest do-Test-nfsv4-only -- run 'service nfs stop' -+ rlPhaseStartTest do-Test-bz641291-nfsv4-only -+ run 'service_nfs stop' -+ run 'cp /etc/sysconfig/nfs /etc/sysconfig/nfs.backup' - # MOUNTD_NFS_V2 MOUNTD_NFS_V3 was not supported in RHEL-7.x -- run 'echo -e "RPCMOUNTDOPTS=\"-N 2 -N 3\"" >>/etc/sysconfig/nfs' 0 "enabling nfsv4 only" -- # If in RHEL-7.1 or later need restart nfs-config service to flush /etc/sysconfig/nfs to /run/sysconfig/nfs-utils -- # But since RHEL-7.3, nfs-config change to be ru-run during the dependent service starting -+ run 'echo "RPCMOUNTDOPTS=\"-N 2 -N 3\"" > /etc/sysconfig/nfs' 0 "disabling mountd v2/v3" - run 'service_nfsconfig status &>/dev/null && service_nfsconfig restart' - -- run 'cat /run/sysconfig/nfs-utils | grep RPCMOUNTDARGS | grep "\""' 0 "quote variable in /run/sysconfig/nfs-utils" - run 'sleep 5' 0 "sleep a while avoid service script bug" - run 'service_nfs start' -+ [ -f /run/sysconfig/nfs-utils ] && \ -+ run 'cat /run/sysconfig/nfs-utils | grep RPCMOUNTDARGS | grep "\""' 0 "bz1175160 quote variable in /run/sysconfig/nfs-utils" - run 'rpcinfo -s | grep -w mountd' 1 "if nfsv4 only, no mountd info in rpcinfo" -- rlFileRestore /etc/sysconfig/nfs -- run 'service_nfsconfig restart' -+ # we allow running V4-only nfsd without rpcbind -+ log "{Info} bz1433390 nfsd startup won't delay in absence of rpcbind" -+ run 'echo "RPCNFSDARGS=\"-N 2 -N 3\"" >>/etc/sysconfig/nfs' 0 "disabling nfsd v2/v3" -+ run 'service_nfsconfig status &>/dev/null && service_nfsconfig restart' - -+ run 'service_nfs restart' -+ [ -f /run/sysconfig/nfs-utils ] && \ -+ run 'cat /run/sysconfig/nfs-utils | grep RPCNFSDARGS' - -+ run 'rpcinfo -s | grep -w nfs' -+ run 'service_nfs stop' -+ run 'service rpcbind stop' -+ run 'systemctl mask rpcbind' 0 "Mask systemd service rpcbind.service" -+ run 'timeLimitRun 10 service_nfs start' 0 "nfs should come up successfully without rpcbind" -+ run 'service_nfs status' -+ run 'systemctl unmask rpcbind' -+ run 'timeLimitRun 10 service_nfs stop' -+ run 'mv /etc/sysconfig/nfs.backup /etc/sysconfig/nfs' -+ run 'service_nfsconfig status &>/dev/null && service_nfsconfig restart' - - rlPhaseEnd - -+ # Accoring to https://bugzilla.redhat.com/show_bug.cgi?id=1126073#c29 - # Since nfs-service no longer starts the daemons in question. They are now split - # into their own services (nfs-mountd.service, rpc-statd.service, nfs-idmapd.service). - # Then `systemctl status nfs-server.service` cannot accurately reflect the - # state of the combination of daemons that are needed for a working NFS server. -- rlPhaseStartTest do-Test-"nfs-server-is-active-even-processes-terminated" -+ rlPhaseStartTest do-Test-"bz1126073-nfs-server-is-active-even-processes-terminated" - run 'service_nfs restart' - run 'pkill rpc.mountd' - - run 'killall -9 nfsd' - - run 'ps axf | grep -e "rpc.mountd" -e "nfsd"' - -- run 'service nfs-mountd status' 1-255 -+ run 'service_nfs-mountd status' 1-255 - run 'rpcinfo -t localhost 100005' 1 "pings mountd" - log '{Info} nfsserver resource agent has been updated to monitor all its daemons' - run 'service_nfs status' 1-255,0 -@@ -183,7 +204,7 @@ rlJournalStart - run 'service_nfs stop' - rlPhaseEnd - -- rlPhaseStartTest do-Test-"should-auto-mount-/proc/fs/nfsd" -+ rlPhaseStartTest do-Test-"bz1010634-should-auto-mount-/proc/fs/nfsd" - run 'service_nfs restart' - run 'service_nfs stop' - run 'umount /proc/fs/nfsd' -@@ -191,95 +212,90 @@ rlJournalStart - run 'mount -t nfsd nfsd /proc/fs/nfsd' - - rlPhaseEnd - -- rlPhaseStartTest do-Test-"use-rpcbind.service-in-nfs-server.service" -+ rlPhaseStartTest do-Test-"bz1171603-use-rpcbind.service-in-nfs-server.service" - run "systemctl reset-failed" 0 "workaround for failure of starting too often" - log "{Info} Starting nfs while rpcbind is stopped" -- run "service rpcbind stop; service rpcbind stop" 0 "stop twice as workaround" -+ run "service rpcbind stop; service rpcbind stop" 0 "stop twice as workaround for bug 1257129" - run "service rpcbind status" 3 "rpcbind.service should be stopped" -- run "service nfs restart" -- run "service nfs status" 0 "should start nfs successfully" -+ run "service_nfs restart" -+ run "service_nfs status" 0 "should start nfs successfully" - run "service rpcbind status" 0 "starting nfs should bring rpcbind up" - - log "{Info} Starting nfs while rpcbind is active" - run "service rpcbind start" - run "service rpcbind status" 0 "rpcbind should be active" -- run "service nfs restart" -- run "service nfs status" 0 "should start nfs successfully" -+ run "service_nfs restart" -+ run "service_nfs status" 0 "should start nfs successfully" - run "service rpcbind status" 0 "starting nfs should keep rpcbind up" - - log "{Info} Stopping nfs while rpcbind is active" - run "service rpcbind start" - run "service rpcbind status" 0 "rpcbind should be active" -- run "service nfs start; service nfs status" -- run "service nfs stop; service nfs status" 3 -+ run "service_nfs start; service_nfs status" -+ run "service_nfs stop; service_nfs status" 3 - run "service rpcbind status" 0 "stopping nfs should keep rpcbind up" - - log "{Info} Stopping nfs while rpcbind is stopped" -- run "service nfs start" 0 "firstly start nfs since it can bring rpcbind up" -- run "service nfs status" 0 "should start nfs successfully" -- run "service rpcbind stop; service rpcbind stop" 0 "stop twice as workaround" -+ run "service_nfs start" 0 "firstly start nfs since it can bring rpcbind up" -+ run "service_nfs status" 0 "should start nfs successfully" -+ run "service rpcbind stop; service rpcbind stop" 0 "stop twice as workaround for bug 1257129" - run "service rpcbind status" 3 "rpcbind should be stopped" -- run "service nfs stop" -+ run "service_nfs stop" - # If a daemon tries to connect to port 111 systemd will start rpcbind automaticly -+ # https://bugzilla.redhat.com/show_bug.cgi?id=1266993#c7 -+ run "sleep 1" 0 "Wait a while for starting" - run "service rpcbind status" 0 "stopping nfs should bring rpcbind up" - rlPhaseEnd - -- rlPhaseStartTest do-Test-"restarting rpbind also restart the the nfs server" -+ rlPhaseStartTest do-Test-bz1266993-"restarting rpbind also restart the the nfs server" - run "systemctl reset-failed" 0 "workaround for failure of starting too often" - log "{Info} Starting rpcbind while nfs is stopped" -- run "service nfs stop" -- run "service nfs status" 3 "nfs should be stopped" -+ run "service_nfs stop" -+ run "service_nfs status" 3 "nfs should be stopped" - run "service rpcbind restart" -- run "service nfs status" 3 "starting rpcbind should NOT bring nfs up" -+ run "service_nfs status" 3 "starting rpcbind should NOT bring nfs up" - - log "{Info} Starting rpcbind while nfs is active" -- run "service nfs start" -- run "service nfs status" 0 "nfs should be active" -+ run "service_nfs start" -+ run "service_nfs status" 0 "nfs should be active" - run "service rpcbind restart" -- run "service nfs status" 0 "starting rpcbind should NOT interfere nfs" -+ run "service_nfs status" 0 "starting rpcbind should NOT interfere nfs" - - log "{Info} Stopping rpcbind while nfs is active" -- run "service nfs start" -- run "service nfs status" 0 "nfs should be active" -+ run "service_nfs start" -+ run "service_nfs status" 0 "nfs should be active" - run "service rpcbind start; service rpcbind stop" -- run "service nfs status" 0 "stopping rpcbind should NOT bring nfs down" -+ run "service_nfs status" 0 "stopping rpcbind should NOT bring nfs down" - - log "{Info} Stopping rpcbind while nfs is stopped" -- run "service nfs stop" -- run "service nfs status" 3 "nfs should be stopped" -+ run "service_nfs stop" -+ run "service_nfs status" 3 "nfs should be stopped" - run "service rpcbind start; service rpcbind stop" -- run "service nfs status" 3 "stopping rpcbind should NOT interfere nfs" -- rlPhaseEnd -- -- rlPhaseStartTest do-Test-fix-long-nfsd-startup-delay-in-absence-of-rpcbind -- run "systemctl stop rpcbind" -- run "systemctl stop nfs-server" -- run "systemctl mask rpcbind" 0 "Mask systemd service rpcbind.service" -- run "timeLimitRun 10 systemctl start nfs-server" 1-255 "Start service nfs-server without rpcbind will be failed due to systemd unit dependency" -- run "systemctl unmask rpcbind" -- run "timeLimitRun 10 systemctl stop nfs-server" - -+ run "service_nfs status" 3 "stopping rpcbind should NOT interfere nfs" - rlPhaseEnd - -- rlPhaseStartTest do-Test-"nfs-utils need to cause gssproxy reload" -- run "cp /etc/gssproxy/gssproxy.conf /etc/gssproxy/gssproxy.conf.backup" 0 "backuping" -- run "echo '[gssproxy]' > /etc/gssproxy/gssproxy.conf" -- run "echo 'debug = true' >> /etc/gssproxy/gssproxy.conf" -- run "systemctl restart gssproxy" --#FIXME when BZ#1535424 is fixed. Should not use /var/log/messages as it is not used on Fedora any more. -- run "echo '' > /var/log/messages" -- run "systemctl restart nfs" -- run "systemctl status nfs" -- run "systemctl status gssproxy" -- run "cat /var/log/messages | grep 'gssproxy:'" - -- run "cat /var/log/messages | grep -q 'gssproxy:.*loaded'" 0 "should re-reading config" -- run "mv /etc/gssproxy/gssproxy.conf.backup /etc/gssproxy/gssproxy.conf" 0 "recovering" -- run "systemctl restart gssproxy" -+ rlPhaseStartTest do-Test-"nfs-utils should reload gssproxy" -+ run "cp /etc/gssproxy/gssproxy.conf /etc/gssproxy/gssproxy.conf.backup" 0 "backuping" -+ run "echo '[gssproxy]' > /etc/gssproxy/gssproxy.conf" -+ run "echo 'debug = true' >> /etc/gssproxy/gssproxy.conf" -+ log "{Info} Check reloading when gssproxy is started" -+ run "systemctl restart gssproxy" -+ run "service_nfs restart" -+ run "systemctl status gssproxy -l" -+ run "systemctl status gssproxy -l | grep 'gssproxy\[[0-9]*\]' | grep -q 'New config loaded'" 0 "Should re-reading config" -+ run "systemctl status gssproxy -l | grep 'systemd\[[0-9]*\]' | grep -q 'Reloaded GSSAPI Proxy Daemon'" 0 "Should re-reading config" -+ log "{Info} Check reloading when gssproxy is stopped" -+ run "systemctl stop gssproxy" -+ run "service_nfs restart" -+ run "systemctl status gssproxy -l" -+ run "systemctl status gssproxy -l | grep 'gssproxy\[[0-9]*\]' | grep -q 'New config loaded'" 0 "Should re-reading config" -+ run "systemctl status gssproxy -l | grep 'systemd\[[0-9]*\]' | grep -q 'Reloaded GSSAPI Proxy Daemon'" 0 "Should re-reading config" -+ run "mv /etc/gssproxy/gssproxy.conf.backup /etc/gssproxy/gssproxy.conf" 0 "recovering" -+ run "systemctl restart gssproxy" - rlPhaseEnd - - rlPhaseStartCleanup do-Cleanup- -- run "userdel -rf testuserqa" - -- rlFileRestore -- run 'timeLimitRun 10 service_nfsconfig restart' -+ cleanup - rlPhaseEnd - - rlJournalEnd -diff --git a/tests/umount/Makefile b/tests/umount/Makefile -new file mode 100644 -index 0000000..4e4da65 ---- /dev/null -+++ b/tests/umount/Makefile -@@ -0,0 +1,79 @@ -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Description: Test for command umount.nfs{,4} -+# Author: Stevens Yin -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+# -+# Copyright (c) 2013 Red Hat, Inc. -+# -+# This program is free software: you can redistribute it and/or -+# modify it under the terms of the GNU General Public License as -+# published by the Free Software Foundation, either version 2 of -+# the License, or (at your option) any later version. -+# -+# This program is distributed in the hope that it will be -+# useful, but WITHOUT ANY WARRANTY; without even the implied -+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -+# PURPOSE. See the GNU General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program. If not, see http://www.gnu.org/licenses/. -+# -+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -+ -+TENV=_env -+ifeq ($(PKG_TOP_DIR),) -+ export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ export _TOP_DIR := $(shell p=$$PWD; while :; do \ -+ [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -+ -include $(PKG_TOP_DIR)/env.mk -+endif -+include $(TENV) -+ifeq ($(_TOP_DIR),) -+ _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) -+endif -+#=============================================================================== -+ -+export TESTVERSION=1.0 -+ -+BUILT_FILES= -+ -+FILES=$(TENV) $(METADATA) runtest.sh Makefile PURPOSE -+ -+.PHONY: all install download clean -+ -+run: $(FILES) build -+ ( set +o posix; [ -e /usr/bin/rhts_environment.sh ] && . /usr/bin/rhts_environment.sh; \ -+. /usr/share/beakerlib/beakerlib.sh; \ -+. runtest.sh ) -+ -+build: $(BUILT_FILES) -+ test -x runtest.sh || chmod a+x runtest.sh -+ -+clean: -+ rm -f *~ $(BUILT_FILES) -+ -+ -+-include /usr/share/rhts/lib/rhts-make.include -+ -+$(METADATA): Makefile -+ @echo "Owner: Stevens Yin " > $(METADATA) -+ @echo "Name: $(TEST)" >> $(METADATA) -+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) -+ @echo "Path: $(TEST_DIR)" >> $(METADATA) -+ @echo "Description: Test for command umount.nfs{,4}" >> $(METADATA) -+ @echo "Type: Regression" >> $(METADATA) -+ @echo "TestTime: 30m" >> $(METADATA) -+ @echo "RunFor: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: $(PACKAGE)" >> $(METADATA) -+ @echo "Requires: library(kernel/base)" >> $(METADATA) -+ @echo "RhtsRequires: library(kernel/base)" >> $(METADATA) -+ @echo "Priority: Normal" >> $(METADATA) -+ @echo "License: GPLv2" >> $(METADATA) -+ @echo "Confidential: no" >> $(METADATA) -+ @echo "Destructive: no" >> $(METADATA) -+ -+ rhts-lint $(METADATA) -+ - -From ae009836a573c8b55e55d9504bf72d63800d83e4 Mon Sep 17 00:00:00 2001 -From: Bruno Goncalves -Date: Jan 21 2019 10:57:57 +0000 -Subject: [PATCH 4/6] fix ipv6 test on export-mount-local - - ---- - -diff --git a/tests/export-mount-local/runtest.sh b/tests/export-mount-local/runtest.sh -index 60d0c90..29a351a 100755 ---- a/tests/export-mount-local/runtest.sh -+++ b/tests/export-mount-local/runtest.sh -@@ -48,7 +48,8 @@ subexpdir=/exportDir-$BZ/sub - tmpnfsmp=${nfsmp}-tmp - - read ipv4 _nil <<<$(getDefaultIp) --read ipv6s _nil <<<$(getDefaultIp 6) -+#read ipv6s _nil <<<$(getDefaultIp 6) -+ipv6s=::1 - ipv6="[$ipv6s]" - # in case "localhost.localdomain" - if echo "$HOSTNAME" | grep -q "localhost"; then - -From 2371443256b25b8d6088788f791284caa012df11 Mon Sep 17 00:00:00 2001 -From: Bruno Goncalves -Date: Jan 21 2019 15:26:27 +0000 -Subject: [PATCH 5/6] add nic name to ipv6 addr - - ---- - -diff --git a/tests/export-mount-local/runtest.sh b/tests/export-mount-local/runtest.sh -index 29a351a..eeb5dde 100755 ---- a/tests/export-mount-local/runtest.sh -+++ b/tests/export-mount-local/runtest.sh -@@ -47,9 +47,9 @@ nfsmp=/mnt/nfsmp-$BZ - subexpdir=/exportDir-$BZ/sub - tmpnfsmp=${nfsmp}-tmp - -+read default_nic <<<$(getDefaultNic) - read ipv4 _nil <<<$(getDefaultIp) --#read ipv6s _nil <<<$(getDefaultIp 6) --ipv6s=::1 -+read ipv6s _nil <<<$(getDefaultIp 6nfs) - ipv6="[$ipv6s]" - # in case "localhost.localdomain" - if echo "$HOSTNAME" | grep -q "localhost"; then - -From 9ba8cf83a319c5894f342e931e94ce61a7c89b88 Mon Sep 17 00:00:00 2001 -From: Bruno Goncalves -Date: Jan 23 2019 08:04:16 +0000 -Subject: [PATCH 6/6] drop export-mount-local test case and add gating file - - ---- - -diff --git a/gating.yaml b/gating.yaml -new file mode 100644 -index 0000000..6985029 ---- /dev/null -+++ b/gating.yaml -@@ -0,0 +1,6 @@ -+--- !Policy -+product_versions: -+ - rhel-8 -+decision_context: osci_compose_gate -+rules: -+ - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} -diff --git a/tests/export-mount-local/Makefile b/tests/export-mount-local/Makefile -deleted file mode 100644 -index 6ddfa94..0000000 ---- a/tests/export-mount-local/Makefile -+++ /dev/null -@@ -1,76 +0,0 @@ --# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --# --# Description: test for: export-mount --# Author: Jianhong Yin --# --# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --# --# Copyright (c) 2014 Red Hat, Inc. --# --# This program is free software: you can redistribute it and/or --# modify it under the terms of the GNU General Public License as --# published by the Free Software Foundation, either version 2 of --# the License, or (at your option) any later version. --# --# This program is distributed in the hope that it will be --# useful, but WITHOUT ANY WARRANTY; without even the implied --# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR --# PURPOSE. See the GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program. If not, see http://www.gnu.org/licenses/. --# --# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- --#Generate and export TEST= PACKAGE= --TENV=_env --ifeq ($(PKG_TOP_DIR),) -- export PKG_TOP_DIR := $(shell p=$$PWD; while :; do \ -- [ -e $$p/env.mk -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -- export _TOP_DIR := $(shell p=$$PWD; while :; do \ -- [ -d $$p/.git -o -z "$$p" ] && { echo $$p; break; }; p=$${p%/*}; done) -- -include $(PKG_TOP_DIR)/env.mk --endif --include $(TENV) --ifeq ($(_TOP_DIR),) -- _TOP_DIR=/mnt/tests/$(TOPLEVEL_NAMESPACE) --endif --#=============================================================================== --export TESTVERSION=1.0 -- --BUILT_FILES= --FILES=$(TENV) $(METADATA) runtest.sh Makefile PURPOSE -- --.PHONY: all install download clean -- --run: $(FILES) build -- ( set +o posix; [ -e /usr/bin/rhts_environment.sh ] && . /usr/bin/rhts_environment.sh; \ --. /usr/share/beakerlib/beakerlib.sh || exit 1; \ --. runtest.sh ) -- --build: $(BUILT_FILES) -- test -x runtest.sh || chmod a+x runtest.sh -- --clean: -- rm -f *~ $(BUILT_FILES) -- ---include /usr/share/rhts/lib/rhts-make.include -- --$(METADATA): Makefile -- @echo "Owner: Jianhong Yin " > $(METADATA) -- @echo "Name: $(TEST)" >> $(METADATA) -- @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) -- @echo "Path: $(TEST_DIR)" >> $(METADATA) -- @echo "Description: test for: export-mount" >> $(METADATA) -- @echo "Type: function" >> $(METADATA) -- @echo "Type: $(PACKAGE)-level-tier1" >> $(METADATA) -- @echo "TestTime: 30m" >> $(METADATA) -- @echo "RunFor: $(PACKAGE)" >> $(METADATA) -- @echo "Requires: $(PACKAGE)" >> $(METADATA) -- @echo "Priority: Normal" >> $(METADATA) -- @echo "License: GPLv2" >> $(METADATA) -- @echo "Requires: library(kernel/base)" >> $(METADATA) -- @echo "Requires: nfs-utils" >> $(METADATA) -- @echo "Requires: bind-utils" >> $(METADATA) -- @echo "RhtsRequires: library(kernel/base)" >> $(METADATA) -- rhts-lint $(METADATA) -diff --git a/tests/export-mount-local/PURPOSE b/tests/export-mount-local/PURPOSE -deleted file mode 100644 -index 556df42..0000000 ---- a/tests/export-mount-local/PURPOSE -+++ /dev/null -@@ -1 +0,0 @@ --# nothing -diff --git a/tests/export-mount-local/_env b/tests/export-mount-local/_env -deleted file mode 100644 -index 90b8e90..0000000 ---- a/tests/export-mount-local/_env -+++ /dev/null -@@ -1,7 +0,0 @@ --export TOPLEVEL_NAMESPACE=nfs-utils --export PKG_NAMESPACE=nfs-utils --export RELATIVE_PATH=export-mount-local --export PACKAGE=nfs-utils --export PACKAGE_NAME=nfs-utils --export PKG_LIST=nfs-utils nfs-utils-lib libnfsidmap libsss_idmap libtirpc rpcbind --export TEST=/nfs-utils/export-mount-local -diff --git a/tests/export-mount-local/runtest.sh b/tests/export-mount-local/runtest.sh -deleted file mode 100755 -index eeb5dde..0000000 ---- a/tests/export-mount-local/runtest.sh -+++ /dev/null -@@ -1,343 +0,0 @@ --#!/bin/bash --# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k --# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --# Description: test for: export-mount-local --# Author: Jianhong Yin --# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --# --# Copyright (c) 2014 Red Hat, Inc. --# --# This copyrighted material is made available to anyone wishing --# to use, modify, copy, or redistribute it subject to the terms --# and conditions of the GNU General Public License version 2. --# --# This program is distributed in the hope that it will be --# useful, but WITHOUT ANY WARRANTY; without even the implied --# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR --# PURPOSE. See the GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public --# License along with this program; if not, write to the Free --# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, --# Boston, MA 02110-1301, USA. --# --# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- --[ -e /usr/bin/rhts-environment.sh ] && . /usr/bin/rhts-environment.sh --. /usr/share/beakerlib/beakerlib.sh || exit 1 -- --# Load beakerlib you needed --rlImport kernel/base --envinfo --#disable_avc_check -- --#=============================================================================== -- --#signal trap --trap "cleanup" SIGINT SIGTERM SIGHUP SIGQUIT --cleanup() { -- rlFileRestore -- rm -rf $expdir $nfsmp --} -- --#global var define --BZ=exp-mount-local --expdir=/exportDir-$BZ --nfsmp=/mnt/nfsmp-$BZ --subexpdir=/exportDir-$BZ/sub --tmpnfsmp=${nfsmp}-tmp -- --read default_nic <<<$(getDefaultNic) --read ipv4 _nil <<<$(getDefaultIp) --read ipv6s _nil <<<$(getDefaultIp 6nfs) --ipv6="[$ipv6s]" --# in case "localhost.localdomain" --if echo "$HOSTNAME" | grep -q "localhost"; then -- ORIGINAL_HOSTNAME="$HOSTNAME" -- HOSTNAME="$BZ" -- hostnamectl set-hostname "$HOSTNAME" --fi --host="$HOSTNAME" -- --rlJournalStart -- rlPhaseStartSetup do-Setup- -- rlFileBackup /etc/{exports,auto.master} /etc/sysconfig/{nfs,autofs} /etc/nfs.conf /etc/hosts -- if [ -n "ORIGINAL_HOSTNAME" ]; then -- run "echo '$ipv4 $host' >> /etc/hosts" -- run "echo '$ipv6s $host' >> /etc/hosts" -- run "cat /etc/hosts" - -- fi -- run "rm -rf $expdir $nfsmp && mkdir -p $expdir $nfsmp" -- run "rm -rf $subexpdir $tmpnfsmp && mkdir -p $subexpdir $tmpnfsmp" -- run "service_nfs restart" -- run "ls_nfsvers" -- rlPhaseEnd -- -- for V in $(ls_nfsvers); do -- # export by IPv4 and try to mount it -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-ipv4 -- run "exportfs -au && exportfs -iv $ipv4:$expdir -o ro,sync,no_root_squash" -- run "mount -o vers=$V $ipv4:$expdir $nfsmp" -- run "umount $nfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-ipv6-x -- if [ -n "$ipv6s" ]; then -- run "mount -o vers=$V $ipv6:$expdir $nfsmp" 1-255 -- [ $? = 0 ] && run "umount $nfsmp" -- fi -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv4-mount-host-bz876847 -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "umount $nfsmp" -- rlPhaseEnd -- -- if [ -n "$ipv6s" ]; then -- # export by IPv6 and try to mount it -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv6 -- run "exportfs -au && exportfs -iv $ipv6:$expdir -o ro,sync,no_root_squash" -- run "mount -o vers=$V $ipv6:$expdir $nfsmp" -- run "umount $nfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-ipv4-x -- run "mount -o vers=$V $ipv4:$expdir $nfsmp" 1-255 -- [ $? = 0 ] && run "umount $nfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-ipv6-mount-host -- run "dig -t aaaa $HOSTNAME +short" 0 "To get the IPv6 address" -- if [ -n "$ipv6s" ]; then -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "umount $nfsmp" -- fi -- rlPhaseEnd -- fi -- -- # export by hostname and try to mount it -- rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-host -- run "exportfs -au && exportfs -iv $host:$expdir -o ro,sync,no_root_squash" -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "umount $nfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv4 -- run "mount -o vers=$V $ipv4:$expdir $nfsmp" -- run "umount $nfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-host-mount-ipv6 -- run "dig -t aaaa $HOSTNAME +short" 0 "To get the IPv6 address" -- if [ -n "$ipv6s" ]; then -- run "mount -o vers=$V $ipv6:$expdir $nfsmp" -- run "umount $nfsmp" -- fi -- rlPhaseEnd -- -- # export sub-directory by IPv4 and try to mount it -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv4 -- run "echo '$expdir *(ro,sync,no_root_squash)' >/etc/exports" -- run "echo '$subexpdir $ipv4(ro,sync,no_root_squash)' >>/etc/exports" -- which systemctl >/dev/null 2>&1 && run "systemctl reset-failed" -- run "service_nfs restart" -- run "showmount -e" - -- run "mount -o vers=$V $ipv4:$expdir $nfsmp" -- run "mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp" -- run "umount $nfsmp $tmpnfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-ipv6-x-bz1198900 -- if [ -n "$ipv6s" ]; then -- run "mount -o vers=$V $ipv6:$expdir $nfsmp" -- run "mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp" 1-255 "bz1198900 should not mount sub-directory with different ip" -- [ $? = 0 ] && run "umount $tmpnfsmp" -- run "umount $nfsmp" -- fi -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv4-mount-host -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "mount -o vers=$V $host:$subexpdir $tmpnfsmp" -- run "umount $nfsmp $tmpnfsmp" -- rlPhaseEnd -- -- if [ -n "$ipv6s" ]; then -- # export sub-directory by IPv6 and try to mount it -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv4-x-bz1198900 -- run "echo '$expdir *(ro,sync,no_root_squash)' >/etc/exports" -- run "echo '$subexpdir $ipv6s(ro,sync,no_root_squash)' >>/etc/exports" -- which systemctl >/dev/null 2>&1 && run "systemctl reset-failed" -- run "service_nfs restart" -- run "showmount -e" - -- run "mount -o vers=$V $ipv4:$expdir $nfsmp" -- run "mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp" 1-255 "bz1198900 should not mount sub-directory with different ip" -- [ $? = 0 ] && run "umount $tmpnfsmp" -- run "umount $nfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-ipv6 -- run "mount -o vers=$V $ipv6:$expdir $nfsmp" -- run "mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp" -- run "umount $nfsmp $tmpnfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-ipv6-mount-host -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "mount -o vers=$V $host:$subexpdir $tmpnfsmp" -- run "umount $nfsmp $tmpnfsmp" -- rlPhaseEnd -- fi -- -- # export sub-directory by hostname and try to mount it -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv4 -- run "echo '$expdir *(ro,sync,no_root_squash)' >/etc/exports" -- run "echo '$subexpdir $host(ro,sync,no_root_squash)' >>/etc/exports" -- which systemctl >/dev/null 2>&1 && run "systemctl reset-failed" -- run "service_nfs restart" -- run "showmount -e" - -- run "mount -o vers=$V $ipv4:$expdir $nfsmp" -- run "mount -o vers=$V $ipv4:$subexpdir $tmpnfsmp" -- run "umount $nfsmp $tmpnfsmp" -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-ipv6 -- if [ -n "$ipv6s" ]; then -- run "mount -o vers=$V $ipv6:$expdir $nfsmp" -- run "mount -o vers=$V $ipv6:$subexpdir $tmpnfsmp" -- run "umount $nfsmp $tmpnfsmp" -- fi -- rlPhaseEnd -- rlPhaseStartTest do-Test-nfsV$V-exp-sub-host-mount-host -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "mount -o vers=$V $host:$subexpdir $tmpnfsmp" -- run "umount $nfsmp $tmpnfsmp" -- rlPhaseEnd -- -- rlPhaseStartTest do-Test-nfsV$V-default-option-overridden-by-client-specific-option -- run "echo '$expdir -ro,sync *(rw,no_root_squash)' >/etc/exports" -- run "service_nfs restart" -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "exports option should be overridden by client specific." -- run "rm -rf $nfsmp/test*" -- run "umount $nfsmp" -- run "echo '$expdir -ro,sec=sys,sync *(rw,no_root_squash)' >/etc/exports" 0 "sec=sys may cause it to be failed." -- run "exportfs -rv" -- run "mount -o vers=$V $host:$expdir $nfsmp" -- run "touch $nfsmp/testfile && mkdir $nfsmp/testdir" 0 "bz1359042 exports option should be overridden by client specific." -- run "rm -rf $nfsmp/test*" -- run "umount $nfsmp" -- rlPhaseEnd -- done -- -- rlPhaseStartTest do-Test-bz1479135-server-side-using-bind-mount -- run "dd if=/dev/zero of=workspace.image bs=3M count=500" -- run "mkfs -t ext3 -F workspace.image" -- run "mkdir -p /workspace" -- run "mount -o loop workspace.image /workspace" -- run "mkdir -p /workspace/vmcore /srv/nfs/vmcore" -- run "touch /workspace/work_dir /workspace/vmcore/vmcore_dir" -- run "mount --bind /workspace/vmcore /srv/nfs/vmcore" -- run "echo '/srv/nfs/vmcore *(rw,no_root_squash)' > /etc/exports" -- run "echo '/workspace *(rw,no_root_squash)' >> /etc/exports" -- run "service_nfs restart" -- run "mount $host:/workspace $nfsmp" -- run "ls $nfsmp/work_dir" -- run "umount $nfsmp" -- run "exportfs -au" && run "service_nfs stop" -- run "umount /srv/nfs/vmcore" -- run "umount /workspace" -- run "rm -rf /workspace /srv/nfs/vmcore" -- run "rm workspace.image" -- rlPhaseEnd -- -- rlPhaseStartTest do-Test-bz1465259-mount-nfsv4-show-wrong-port -- run "echo '$expdir *(rw,no_root_squash)' > /etc/exports" -- run "service_nfs restart" -- run "exportfs -v" -- run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" -- run "cat /proc/mounts | grep $nfsmp" - -- run "cat /proc/mounts | grep $nfsmp | grep -q 'port='" 1 "Omit displaying 'port=' by default" -- run "mount -o remount,ro $nfsmp" -- run "cat /proc/mounts | grep $nfsmp" - -- run "cat /proc/mounts | grep $nfsmp | grep -q 'port='" 1 "Omit displaying 'port=' by default" -- run "umount $nfsmp" -- if [ -e "/etc/nfs.conf" ]; then -- echo "[nfsd]" > /etc/nfs.conf -- echo "port=20050" >> /etc/nfs.conf -- run "cat /etc/nfs.conf" - -- run "service_nfs restart" -- run "sleep 10" -- run "rpcinfo -p | grep -w nfs | grep 20050" -- run "mount -t nfs4 -o port=20050 localhost:$expdir $nfsmp" -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "cat /proc/mounts | grep $nfsmp | grep -q port=20050" 0 "Should show port=20050" -- run "mount -o remount,ro $nfsmp" -- run "cat /proc/mounts | grep $nfsmp" - -- run "cat /proc/mounts | grep $nfsmp | grep -q port=20050" 0 "Should show port=20050" -- run "umount $nfsmp" -- fi -- log "{Info} If NFS service is not available on the specified port" -- run "mount -t nfs4 -o port=2049 localhost:$expdir $nfsmp" 1-255 -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "umount $nfsmp" -- fi -- log "{Info} If port value is not specified" -- if ls_nfsvers | grep -q -w 3; then -- run "mount -t nfs -o vers=3 localhost:$expdir $nfsmp" 0 "for v2/v3 client uses port advertised by server's rpcbind service" -- run "cat /proc/mounts | grep $nfsmp" - -- run "umount $nfsmp" -- fi -- run "mount -t nfs -o vers=4 localhost:$expdir $nfsmp" 1-255 "for v4 client uses the standard NFS port (2049) without checking" -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "umount $nfsmp" -- fi -- log "{Info} If the specified port value is 0" -- run "mount -t nfs -o vers=4,port=0 localhost:$expdir $nfsmp" -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "cat /proc/mounts | grep $nfsmp | grep -q port=0" 0 "Should show port=0" -- run "umount $nfsmp" -- fi -- run "echo '' > /etc/nfs.conf" 0 "Recovering" -- fi -- rlPhaseEnd -- -- if ls_nfsvers | grep -q -w "4.0"; then -- rlPhaseStartTest do-Test-bz1592915-sanity-check-clientaddr-during-mount -- run "echo '$expdir *(rw,no_root_squash)' > /etc/exports" -- run "service_nfs restart" -- run "exportfs -v" -- log "{Info} Mounting v4.0 by default" -- run "mount -o vers=4,minorversion=0 localhost:$expdir $nfsmp -v" -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "umount $nfsmp" -- fi -- log "{Info} Setting 'clientaddr=' not match any local address" -- # use normal mode (no verbose) to check the emitted warning -- run "mount -o vers=4,minorversion=0,clientaddr=1.2.3.4 localhost:$expdir $nfsmp &> >(tee stdout.log)" -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "umount $nfsmp" -- fi -- run "cat stdout.log | grep -q '[warning].*not match any existing network addresses'" 0 "Should warn the administrators" -- log "{Info} Specifying IPv4_ANY (0.0.0.0) signifying client does not want delegations" -- run "mount -o vers=4,minorversion=0,clientaddr=0.0.0.0 localhost:$expdir $nfsmp -v" -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "umount $nfsmp" -- fi -- log "{Info} Specifying IPv6_ANY (::0) signifying client does not want delegations" -- run "mount -o vers=4,minorversion=0,clientaddr=::0 localhost:$expdir $nfsmp -v" -- if [ $? -eq 0 ]; then -- run "cat /proc/mounts | grep $nfsmp" - -- run "umount $nfsmp" -- fi -- rlPhaseEnd -- fi -- -- rlPhaseStartCleanup do-Cleanup- -- run "rm -rf $expdir $nfsmp $subexpdir $tmpnfsmp" -- rlFileRestore -- run "service_nfs restart" -- if [ -n "ORIGINAL_HOSTNAME" ]; then -- HOSTNAME="$ORIGINAL_HOSTNAME" -- hostnamectl set-hostname "$HOSTNAME" -- fi -- rlPhaseEnd --rlJournalEnd --#rlJournalPrintText --#enable_avc_check -diff --git a/tests/export-mount-local/subtest.yml b/tests/export-mount-local/subtest.yml -deleted file mode 100644 -index 1a77920..0000000 ---- a/tests/export-mount-local/subtest.yml -+++ /dev/null -@@ -1 +0,0 @@ --attr: {ssched: yes} -diff --git a/tests/tests.yml b/tests/tests.yml -index 865464b..e8d6ecb 100644 ---- a/tests/tests.yml -+++ b/tests/tests.yml -@@ -8,13 +8,11 @@ - - classic - tests: - - exportfs -- - export-mount-local - - mount - - nfs-mount-options-all - - systemd-nfs - - umount - required_packages: -- - bind-utils # export-mount-local needs this package - - findutils # beakerlib needs find command - - iptables # nfs-mount-options-all needs this package - - nfs-utils - diff --git a/SOURCES/nfs-utils-2.3.3-gssd-verbose.patch b/SOURCES/nfs-utils-2.3.3-gssd-verbose.patch new file mode 100644 index 0000000..2618ef2 --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-gssd-verbose.patch @@ -0,0 +1,52 @@ +commit 64d83364b08ab32c6b8fee903529314349175772 +Author: Pierguido Lambri +Date: Mon Mar 11 13:50:57 2019 -0400 + + gssd: add verbosity options to the rpc.gssd man page + + It also adds the commented out entries in the nfs.conf + default file. + + Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1668026 + + Signed-off-by: Pierguido Lambri + Signed-off-by: Steve Dickson + +diff -up nfs-utils-2.3.3/nfs.conf.orig nfs-utils-2.3.3/nfs.conf +--- nfs-utils-2.3.3/nfs.conf.orig 2019-03-19 11:04:16.903567972 -0400 ++++ nfs-utils-2.3.3/nfs.conf 2019-03-19 11:10:54.452251970 -0400 +@@ -9,6 +9,8 @@ + # debug=0 + # + [gssd] ++# verbosity=0 ++# rpc-verbosity=0 + # use-memcache=0 + # use-machine-creds=1 + use-gss-proxy=1 +diff -up nfs-utils-2.3.3/systemd/nfs.conf.man.orig nfs-utils-2.3.3/systemd/nfs.conf.man +--- nfs-utils-2.3.3/systemd/nfs.conf.man.orig 2019-03-19 11:04:16.911567926 -0400 ++++ nfs-utils-2.3.3/systemd/nfs.conf.man 2019-03-19 11:10:54.452251970 -0400 +@@ -211,6 +211,8 @@ for details. + .TP + .B gssd + Recognized values: ++.BR verbosity , ++.BR rpc-verbosity , + .BR use-memcache , + .BR use-machine-creds , + .BR use-gss-proxy , +diff -up nfs-utils-2.3.3/utils/gssd/gssd.c.orig nfs-utils-2.3.3/utils/gssd/gssd.c +--- nfs-utils-2.3.3/utils/gssd/gssd.c.orig 2019-03-19 11:04:16.893568031 -0400 ++++ nfs-utils-2.3.3/utils/gssd/gssd.c 2019-03-19 11:10:54.453251964 -0400 +@@ -890,8 +890,8 @@ main(int argc, char *argv[]) + + read_gss_conf(); + +- verbosity = conf_get_num("gssd", "Verbosity", verbosity); +- rpc_verbosity = conf_get_num("gssd", "RPC-Verbosity", rpc_verbosity); ++ verbosity = conf_get_num("gssd", "verbosity", verbosity); ++ rpc_verbosity = conf_get_num("gssd", "rpc-verbosity", rpc_verbosity); + + while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:T:R:")) != -1) { + switch (opt) { diff --git a/SOURCES/nfs-utils-2.3.3-lseek-error-handling.patch b/SOURCES/nfs-utils-2.3.3-lseek-error-handling.patch new file mode 100644 index 0000000..af76564 --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-lseek-error-handling.patch @@ -0,0 +1,49 @@ +From fd2e952319c748e1c7babb1db97b371ebf6748a9 Mon Sep 17 00:00:00 2001 +From: Alice J Mitchell +Date: Mon, 29 Jul 2019 15:47:40 +0100 +Subject: [PATCH] Fix the error handling if the lseek fails + +The error case when lseek returns a negative value was not correctly handled, +and the error cleanup routine was potentially leaking memory also. + +Signed-off-by: Alice J Mitchell +--- + support/nfs/conffile.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c +index b6400be..6ba8a35 100644 +--- a/support/nfs/conffile.c ++++ b/support/nfs/conffile.c +@@ -500,7 +500,7 @@ conf_readfile(const char *path) + + if ((stat (path, &sb) == 0) || (errno != ENOENT)) { + char *new_conf_addr = NULL; +- size_t sz = sb.st_size; ++ off_t sz; + int fd = open (path, O_RDONLY, 0); + + if (fd == -1) { +@@ -517,6 +517,11 @@ conf_readfile(const char *path) + + /* only after we have the lock, check the file size ready to read it */ + sz = lseek(fd, 0, SEEK_END); ++ if (sz < 0) { ++ xlog_warn("conf_readfile: unable to determine file size: %s", ++ strerror(errno)); ++ goto fail; ++ } + lseek(fd, 0, SEEK_SET); + + new_conf_addr = malloc(sz+1); +@@ -2162,6 +2167,7 @@ conf_write(const char *filename, const char *section, const char *arg, + ret = 0; + + cleanup: ++ flush_outqueue(&inqueue, NULL); + flush_outqueue(&outqueue, NULL); + + if (buff) +-- +1.8.3.1 + diff --git a/SOURCES/nfs-utils-2.3.3-memleak-on-error.patch b/SOURCES/nfs-utils-2.3.3-memleak-on-error.patch new file mode 100644 index 0000000..e9bf332 --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-memleak-on-error.patch @@ -0,0 +1,37 @@ +From ccdd8c803182f5c172580379a56e84a23789cf0d Mon Sep 17 00:00:00 2001 +From: Alice J Mitchell +Date: Mon, 29 Jul 2019 15:49:34 +0100 +Subject: [PATCH] Fix memory leak on error in nfs-server-generator + +Fix the trivial memory leak in the error handling of nfs-server-generator + +Resolves: bz1440524 +Signed-off-by: Alice J Mitchell +--- + systemd/nfs-server-generator.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c +index 737f109..eec98fd 100644 +--- a/systemd/nfs-server-generator.c ++++ b/systemd/nfs-server-generator.c +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include "misc.h" + #include "nfslib.h" +@@ -98,7 +99,7 @@ int main(int argc, char *argv[]) + exit(1); + } + +- path = malloc(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase)); ++ path = alloca(strlen(argv[1]) + sizeof(dirbase) + sizeof(filebase)); + if (!path) + exit(2); + if (export_read(_PATH_EXPORTS, 1) + +-- +1.8.3.1 + diff --git a/SOURCES/nfs-utils-2.3.3-mount-fallback.patch b/SOURCES/nfs-utils-2.3.3-mount-fallback.patch new file mode 100644 index 0000000..68c72ae --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-mount-fallback.patch @@ -0,0 +1,48 @@ +commit a709f25c1da4a2fb44a1f3fd060298fbbd88aa3c +Author: Steve Dickson +Date: Tue May 14 15:52:50 2019 -0400 + + mount: Report correct error in the fall_back cases. + + In mount auto negotiation, a v3 mount is tried + when the v4 fails with error that could mean + v4 is not supported. + + When the v3 mount fails, the original v4 failure + should be used to set the errno, not the v3 failure. + + Fixes:https://bugzilla.redhat.com/show_bug.cgi?id=1709961 + Signed-off-by: Steve Dickson + +diff -up nfs-utils-2.3.3/utils/mount/stropts.c.orig nfs-utils-2.3.3/utils/mount/stropts.c +--- nfs-utils-2.3.3/utils/mount/stropts.c.orig 2019-08-12 10:58:32.610650773 -0400 ++++ nfs-utils-2.3.3/utils/mount/stropts.c 2019-08-12 11:10:39.661142985 -0400 +@@ -888,7 +888,7 @@ out: + */ + static int nfs_autonegotiate(struct nfsmount_info *mi) + { +- int result; ++ int result, olderrno; + + result = nfs_try_mount_v4(mi); + check_result: +@@ -948,7 +948,18 @@ fall_back: + if (mi->version.v_mode == V_GENERAL) + /* v2,3 fallback not allowed */ + return result; +- return nfs_try_mount_v3v2(mi, FALSE); ++ ++ /* ++ * Save the original errno in case the v3 ++ * mount fails from one of the fall_back cases. ++ * Report the first failure not the v3 mount failure ++ */ ++ olderrno = errno; ++ if ((result = nfs_try_mount_v3v2(mi, FALSE))) ++ return result; ++ ++ errno = olderrno; ++ return result; + } + + /* diff --git a/SOURCES/nfs-utils-2.3.3-mountd-memleak.patch b/SOURCES/nfs-utils-2.3.3-mountd-memleak.patch new file mode 100644 index 0000000..d52d063 --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-mountd-memleak.patch @@ -0,0 +1,77 @@ +commit 50ef80739d9e1e0df6616289ef2ff626a94666ee +Author: Steve Dickson +Date: Thu May 23 09:24:49 2019 -0400 + + rpc.mountd: Fix e_hostname and e_uuid leaks + + strdup of exportent uuid and hostname in getexportent() ends up leaking + memory. Free the memory before getexportent() is called again from xtab_read() + + Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1713360 + Signed-off-by: Nikhil Kshirsagar + Signed-off-by: Steve Dickson + +diff --git a/support/export/xtab.c b/support/export/xtab.c +index d42eeef..1e1d679 100644 +--- a/support/export/xtab.c ++++ b/support/export/xtab.c +@@ -50,6 +50,14 @@ xtab_read(char *xtab, char *lockfn, int is_export) + while ((xp = getexportent(is_export==0, 0)) != NULL) { + if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) && + !(exp = export_create(xp, is_export!=1))) { ++ if(xp->e_hostname) { ++ free(xp->e_hostname); ++ xp->e_hostname=NULL; ++ } ++ if(xp->e_uuid) { ++ free(xp->e_uuid); ++ xp->e_uuid=NULL; ++ } + continue; + } + switch (is_export) { +@@ -62,7 +70,16 @@ xtab_read(char *xtab, char *lockfn, int is_export) + if ((xp->e_flags & NFSEXP_FSID) && xp->e_fsid == 0) + v4root_needed = 0; + break; +- } ++ } ++ if(xp->e_hostname) { ++ free(xp->e_hostname); ++ xp->e_hostname=NULL; ++ } ++ if(xp->e_uuid) { ++ free(xp->e_uuid); ++ xp->e_uuid=NULL; ++ } ++ + } + endexportent(); + xfunlock(lockid); +diff --git a/support/nfs/exports.c b/support/nfs/exports.c +index 5f4cb95..a7582ca 100644 +--- a/support/nfs/exports.c ++++ b/support/nfs/exports.c +@@ -179,9 +179,20 @@ getexportent(int fromkernel, int fromexports) + } + ee.e_hostname = xstrdup(hostname); + +- if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0) +- return NULL; ++ if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0) { ++ if(ee.e_hostname) ++ { ++ xfree(ee.e_hostname); ++ ee.e_hostname=NULL; ++ } ++ if(ee.e_uuid) ++ { ++ xfree(ee.e_uuid); ++ ee.e_uuid=NULL; ++ } + ++ return NULL; ++ } + /* resolve symlinks */ + if (realpath(ee.e_path, rpath) != NULL) { + rpath[sizeof (rpath) - 1] = '\0'; diff --git a/SOURCES/nfs-utils-2.3.3-nfsconf-inplace.patch b/SOURCES/nfs-utils-2.3.3-nfsconf-inplace.patch new file mode 100644 index 0000000..155925d --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-nfsconf-inplace.patch @@ -0,0 +1,276 @@ +diff -up nfs-utils-2.3.3/support/nfs/conffile.c.orig nfs-utils-2.3.3/support/nfs/conffile.c +--- nfs-utils-2.3.3/support/nfs/conffile.c.orig 2018-09-06 14:09:08.000000000 -0400 ++++ nfs-utils-2.3.3/support/nfs/conffile.c 2019-04-25 10:58:27.199907596 -0400 +@@ -50,6 +50,7 @@ + #include + #include + #include ++#include + + #include "conffile.h" + #include "xlog.h" +@@ -509,6 +510,17 @@ conf_readfile(const char *path) + return NULL; + } + ++ /* Grab a shared lock to ensure its not mid-rewrite */ ++ if (flock(fd, LOCK_SH)) { ++ xlog_warn("conf_readfile: attempt to grab read lock failed: %s", ++ strerror(errno)); ++ goto fail; ++ } ++ ++ /* only after we have the lock, check the file size ready to read it */ ++ sz = lseek(fd, 0, SEEK_END); ++ lseek(fd, 0, SEEK_SET); ++ + new_conf_addr = malloc(sz+1); + if (!new_conf_addr) { + xlog_warn("conf_readfile: malloc (%lu) failed", (unsigned long)sz); +@@ -1588,6 +1600,17 @@ flush_outqueue(struct tailhead *queue, F + return 0; + } + ++/* append one queue to another */ ++static void ++append_queue(struct tailhead *inq, struct tailhead *outq) ++{ ++ while (inq->tqh_first != NULL) { ++ struct outbuffer *ob = inq->tqh_first; ++ TAILQ_REMOVE(inq, ob, link); ++ TAILQ_INSERT_TAIL(outq, ob, link); ++ } ++} ++ + /* read one line of text from a file, growing the buffer as necessary */ + static int + read_line(char **buff, int *buffsize, FILE *in) +@@ -1728,6 +1751,16 @@ is_folded(const char *line) + return false; + } + ++static int ++lock_file(FILE *f) ++{ ++ int ret; ++ ret = flock(fileno(f), LOCK_EX); ++ if (ret) ++ xlog(L_ERROR, "Error could not lock the file"); ++ return ret; ++} ++ + /*** + * Write a value to an nfs.conf style filename + * +@@ -1738,15 +1771,14 @@ int + conf_write(const char *filename, const char *section, const char *arg, + const char *tag, const char *value) + { +- int fdout = -1; +- char *outpath = NULL; +- FILE *outfile = NULL; + FILE *infile = NULL; + int ret = 1; + struct tailhead outqueue; ++ struct tailhead inqueue; + char * buff = NULL; + int buffsize = 0; + ++ TAILQ_INIT(&inqueue); + TAILQ_INIT(&outqueue); + + if (!filename) { +@@ -1759,26 +1791,7 @@ conf_write(const char *filename, const c + return ret; + } + +- if (asprintf(&outpath, "%s.XXXXXX", filename) == -1) { +- xlog(L_ERROR, "conf_write: error composing temp filename"); +- return ret; +- } +- +- fdout = mkstemp(outpath); +- if (fdout < 0) { +- xlog(L_ERROR, "conf_write: open temp file %s failed: %s", +- outpath, strerror(errno)); +- goto cleanup; +- } +- +- outfile = fdopen(fdout, "w"); +- if (!outfile) { +- xlog(L_ERROR, "conf_write: fdopen temp file failed: %s", +- strerror(errno)); +- goto cleanup; +- } +- +- infile = fopen(filename, "r"); ++ infile = fopen(filename, "r+"); + if (!infile) { + if (!value) { + xlog_warn("conf_write: config file \"%s\" not found, nothing to do", filename); +@@ -1787,18 +1800,29 @@ conf_write(const char *filename, const c + } + + xlog_warn("conf_write: config file \"%s\" not found, creating.", filename); +- if (append_line(&outqueue, NULL, make_section(section, arg))) ++ infile = fopen(filename, "wx"); ++ if (!infile) { ++ xlog(L_ERROR, "conf_write: Error creating config file \"%s\".", filename); ++ goto cleanup; ++ } ++ ++ if (lock_file(infile)) + goto cleanup; + +- if (append_line(&outqueue, NULL, make_tagline(tag, value))) ++ if (append_line(&inqueue, NULL, make_section(section, arg))) + goto cleanup; + +- if (flush_outqueue(&outqueue, outfile)) ++ if (append_line(&inqueue, NULL, make_tagline(tag, value))) + goto cleanup; ++ ++ append_queue(&inqueue, &outqueue); + } else { + bool found = false; + int err = 0; + ++ if (lock_file(infile)) ++ goto cleanup; ++ + buffsize = 4096; + buff = calloc(1, buffsize); + if (buff == NULL) { +@@ -1813,7 +1837,7 @@ conf_write(const char *filename, const c + /* read in one section worth of lines */ + do { + if (*buff != '\0') { +- if (append_line(&outqueue, NULL, strdup(buff))) ++ if (append_line(&inqueue, NULL, strdup(buff))) + goto cleanup; + } + +@@ -1821,7 +1845,7 @@ conf_write(const char *filename, const c + } while (err == 0 && buff[0] != '['); + + /* find the section header */ +- where = TAILQ_FIRST(&outqueue); ++ where = TAILQ_FIRST(&inqueue); + while (where != NULL) { + if (where->text != NULL && where->text[0] == '[') + break; +@@ -1845,7 +1869,7 @@ conf_write(const char *filename, const c + /* remove current tag */ + do { + struct outbuffer *next = TAILQ_NEXT(where, link); +- TAILQ_REMOVE(&outqueue, where, link); ++ TAILQ_REMOVE(&inqueue, where, link); + if (is_folded(where->text)) + again = true; + else +@@ -1857,14 +1881,14 @@ conf_write(const char *filename, const c + + /* insert new tag */ + if (value) { +- if (append_line(&outqueue, prev, make_tagline(tag, value))) ++ if (append_line(&inqueue, prev, make_tagline(tag, value))) + goto cleanup; + } + } else + /* no existing assignment found and we need to add one */ + if (value) { + /* rewind past blank lines and comments */ +- struct outbuffer *tail = TAILQ_LAST(&outqueue, tailhead); ++ struct outbuffer *tail = TAILQ_LAST(&inqueue, tailhead); + + /* comments immediately before a section usually relate + * to the section below them */ +@@ -1876,7 +1900,7 @@ conf_write(const char *filename, const c + tail = TAILQ_PREV(tail, tailhead, link); + + /* now add the tag here */ +- if (append_line(&outqueue, tail, make_tagline(tag, value))) ++ if (append_line(&inqueue, tail, make_tagline(tag, value))) + goto cleanup; + + found = true; +@@ -1886,49 +1910,45 @@ conf_write(const char *filename, const c + /* EOF and correct section not found, so add one */ + if (err && !found && value) { + /* did the last section end in a blank line */ +- struct outbuffer *tail = TAILQ_LAST(&outqueue, tailhead); ++ struct outbuffer *tail = TAILQ_LAST(&inqueue, tailhead); + if (tail && !is_empty(tail->text)) { + /* no, so add one for clarity */ +- if (append_line(&outqueue, NULL, strdup("\n"))) ++ if (append_line(&inqueue, NULL, strdup("\n"))) + goto cleanup; + } + + /* add the new section header */ +- if (append_line(&outqueue, NULL, make_section(section, arg))) ++ if (append_line(&inqueue, NULL, make_section(section, arg))) + goto cleanup; + + /* now add the tag */ +- if (append_line(&outqueue, NULL, make_tagline(tag, value))) ++ if (append_line(&inqueue, NULL, make_tagline(tag, value))) + goto cleanup; + } + +- /* we are done with this section, write it out */ +- if (flush_outqueue(&outqueue, outfile)) +- goto cleanup; ++ /* we are done with this section, move it to the out queue */ ++ append_queue(&inqueue, &outqueue); + } while(err == 0); + } + +- if (infile) { +- fclose(infile); +- infile = NULL; +- } ++ /* now rewind and overwrite the file with the updated data */ ++ rewind(infile); + +- fdout = -1; +- if (fclose(outfile)) { +- xlog(L_ERROR, "Error writing config file: %s", strerror(errno)); ++ if (ftruncate(fileno(infile), 0)) { ++ xlog(L_ERROR, "Error truncating config file"); + goto cleanup; + } + +- /* now swap the old file for the new one */ +- if (rename(outpath, filename)) { +- xlog(L_ERROR, "Error updating config file: %s: %s\n", filename, strerror(errno)); +- ret = 1; +- } else { +- ret = 0; +- free(outpath); +- outpath = NULL; ++ if (flush_outqueue(&outqueue, infile)) ++ goto cleanup; ++ ++ if (infile) { ++ fclose(infile); ++ infile = NULL; + } + ++ ret = 0; ++ + cleanup: + flush_outqueue(&outqueue, NULL); + +@@ -1936,11 +1956,5 @@ cleanup: + free(buff); + if (infile) + fclose(infile); +- if (fdout != -1) +- close(fdout); +- if (outpath) { +- unlink(outpath); +- free(outpath); +- } + return ret; + } diff --git a/SOURCES/nfs-utils-2.3.3-nfsconf-manage-gids.patch b/SOURCES/nfs-utils-2.3.3-nfsconf-manage-gids.patch new file mode 100644 index 0000000..43de59a --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-nfsconf-manage-gids.patch @@ -0,0 +1,23 @@ +commit 268e3c0cff6d6aee3b8f5458545f8dab76d7d444 +Author: Steve Dickson +Date: Mon Feb 4 15:17:42 2019 -0500 + + nfs.conf: Fixed manage-gids option typo + + Reported-by: Adam DiFrischia + BugLink: https://bugzilla.linux-nfs.org/show_bug.cgi?id=333 + Signed-off-by: Steve Dickson + +diff --git a/nfs.conf b/nfs.conf +index 796bee4..722b024 100644 +--- a/nfs.conf ++++ b/nfs.conf +@@ -26,7 +26,7 @@ + # + [mountd] + # debug=0 +-# manage_gids=n ++# manage-gids=n + # descriptors=0 + # port=0 + # threads=1 diff --git a/SOURCES/nfs-utils-2.3.3-nfsman-typo.patch b/SOURCES/nfs-utils-2.3.3-nfsman-typo.patch new file mode 100644 index 0000000..467b2c4 --- /dev/null +++ b/SOURCES/nfs-utils-2.3.3-nfsman-typo.patch @@ -0,0 +1,22 @@ +commit 2b78802c4eda6f74b77330832c54fd6b59991adf +Author: Josef Radinger +Date: Wed Jul 24 10:59:51 2019 -0400 + + nfs.man: Fixed small typo in man page + + Fixes: https://bugzilla.linux-nfs.org/show_bug.cgi?id=337 + Signed-off-by: Steve Dickson + +diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man +index 9ee9bd9..6ba9cef 100644 +--- a/utils/mount/nfs.man ++++ b/utils/mount/nfs.man +@@ -1252,7 +1252,7 @@ If absolute cache coherence among clients is required, + applications should use file locking. Alternatively, applications + can also open their files with the O_DIRECT flag + to disable data caching entirely. +-.SS "File timestamp maintainence" ++.SS "File timestamp maintenance" + NFS servers are responsible for managing file and directory timestamps + .RB ( atime , + .BR ctime ", and" diff --git a/SOURCES/nfs-utils-2.3.3-statd-force.patch b/SOURCES/nfs-utils-2.3.3-statd-force.patch index 24b786c..bd335f2 100644 --- a/SOURCES/nfs-utils-2.3.3-statd-force.patch +++ b/SOURCES/nfs-utils-2.3.3-statd-force.patch @@ -1,7 +1,7 @@ diff -up nfs-utils-2.3.3/nfs.conf.orig nfs-utils-2.3.3/nfs.conf ---- nfs-utils-2.3.3/nfs.conf.orig 2019-08-13 11:10:15.801644147 -0400 -+++ nfs-utils-2.3.3/nfs.conf 2019-08-13 11:10:53.767959268 -0400 -@@ -65,6 +65,7 @@ use-gss-proxy=1 +--- nfs-utils-2.3.3/nfs.conf.orig 2019-03-05 10:30:28.100560625 -0500 ++++ nfs-utils-2.3.3/nfs.conf 2019-03-05 10:35:28.702004199 -0500 +@@ -64,6 +64,7 @@ use-gss-proxy=1 # [sm-notify] # debug=0 @@ -10,8 +10,8 @@ diff -up nfs-utils-2.3.3/nfs.conf.orig nfs-utils-2.3.3/nfs.conf # outgoing-port= # outgoing-addr= diff -up nfs-utils-2.3.3/utils/statd/sm-notify.c.orig nfs-utils-2.3.3/utils/statd/sm-notify.c ---- nfs-utils-2.3.3/utils/statd/sm-notify.c.orig 2019-08-13 11:10:15.788644039 -0400 -+++ nfs-utils-2.3.3/utils/statd/sm-notify.c 2019-08-13 11:10:53.768959276 -0400 +--- nfs-utils-2.3.3/utils/statd/sm-notify.c.orig 2019-03-05 10:30:28.070560401 -0500 ++++ nfs-utils-2.3.3/utils/statd/sm-notify.c 2019-03-05 10:35:28.703004207 -0500 @@ -49,6 +49,7 @@ #define NLM_END_GRACE_FILE "/proc/fs/lockd/nlm_end_grace" diff --git a/SOURCES/nfsconvert.sh b/SOURCES/nfsconvert.sh index f4e5b2d..ce28562 100644 --- a/SOURCES/nfsconvert.sh +++ b/SOURCES/nfsconvert.sh @@ -36,9 +36,3 @@ fi # /usr/sbin/nfsconvert -# -# Make sure the modes are correct -# -if [ $? -eq 0 ]; then - chmod 644 /etc/nfs.conf -fi diff --git a/SPECS/nfs-utils.spec b/SPECS/nfs-utils.spec index 30a1d4c..f893054 100644 --- a/SPECS/nfs-utils.spec +++ b/SPECS/nfs-utils.spec @@ -2,7 +2,7 @@ Summary: NFS utilities and supporting clients and daemons for the kernel NFS ser Name: nfs-utils URL: http://linux-nfs.org/ Version: 2.3.3 -Release: 14%{?dist}.2 +Release: 26%{?dist} Epoch: 1 # group all 32bit related archs @@ -26,19 +26,27 @@ Patch004: nfs-utils-2.3.3-gssd-usegssproxy.patch Patch005: nfs-utils-2.3.3-nfsconf-usegssproxy.patch Patch006: nfs-utils-2.3.3-man-tcpwrappers.patch Patch007: nfs-utils-2.3.3-junction-update.patch -Patch008: nfs-utils-2.3.3-gating-tests.patch # -# RHEL 8.0-Z +# RHEL 8.1 # -Patch009: nfs-utils-2.3.3-statd-no-notify.patch -Patch010: nfs-utils-2.3.3-statd-force.patch +Patch008: nfs-utils-2.3.3-nfsconf-manage-gids.patch +Patch009: nfs-utils-2.3.3-statd-force.patch +Patch010: nfs-utils-2.3.3-statd-no-notify.patch +Patch011: nfs-utils-2.3.3-gssd-verbose.patch +Patch012: nfs-utils-2.3.3-nfsconf-inplace.patch +Patch013: nfs-utils-2.3.3-covscan-resource-leaks.patch +Patch014: nfs-utils-2.3.3-nfsman-typo.patch +Patch015: nfs-utils-2.3.3-mount-fallback.patch +Patch016: nfs-utils-2.3.3-mountd-memleak.patch Patch100: nfs-utils-1.2.1-statdpath-man.patch Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch Patch102: nfs-utils-1.2.5-idmap-errmsg.patch Patch103: nfs-utils-2.3.1-systemd-gssproxy-restart.patch Patch104: nfs-utils-2.3.1-systemd-svcgssd-removed.patch +Patch105: nfs-utils-2.3.3-lseek-error-handling.patch +Patch106: nfs-utils-2.3.3-memleak-on-error.patch Provides: exportfs = %{epoch}:%{version}-%{release} Provides: nfsstat = %{epoch}:%{version}-%{release} @@ -266,7 +274,7 @@ fi %dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd %dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm %dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm.bak -%ghost %attr(644,rpcuser,rpcuser) %{_statdpath}/state +%ghost %attr(644,root,root) %{_statdpath}/state %config(noreplace) %{_sharedstatedir}/nfs/etab %config(noreplace) %{_sharedstatedir}/nfs/rmtab %config(noreplace) %{_sysconfdir}/request-key.d/id_resolver.conf @@ -309,8 +317,6 @@ fi %config(noreplace) %{_sysconfdir}/idmapd.conf %{_libdir}/libnfsidmap.so.* %{_libdir}/libnfsidmap/*.so -%{_mandir}/man3/nfs4_uid_to_name.* -%{_mandir}/man5/idmapd.conf.* %files -n libnfsidmap-devel %{_libdir}/pkgconfig/libnfsidmap.pc @@ -319,15 +325,50 @@ fi %{_libdir}/libnfsidmap.so %changelog -* Tue Aug 13 2019 Steve Dickson 2.3.3-14_0.2 -- Add a conversion for new sm-notify force option to sm-notify (bz 1716592) +* Wed Sep 18 2019 Steve Dickson 2.3.3-26 +- Updated coverity scans patch to not do a double free (bz 1752326) -* Mon Aug 05 2019 Steve Dickson 2.3.3-14_0.1 -- Add a conversion for new sm-notify force option in nfs.conf (bz 1716592) +* Mon Aug 19 2019 Steve Dickson 2.3.3-25 +- Change the owner/group of the state file (bz 1733445) -* Wed Apr 3 2019 Steve Dickson 2.3.3-14_0 -- Add nfs.conf equivalent for the statd --no-notify cmdline option (1690280) -- Correct the modes on /etc/nfs.conf after a conversion (bz 1690266) +* Mon Aug 12 2019 Steve Dickson 2.3.3-24 +- nfs.man: Fixed small typo in man page (bz 1732877) +- mount: Report correct error in the fall_back cases (bz 1709963) +- rpc.mountd: Fix e_hostname and e_uuid leaks (bz 1712202) +- spec: Remove redundant manpage files (bz 1718738) + +* Wed Jul 31 2019 Alice Mitchell 2.3.3-23 +- Fix memory leak on error (bz 1440524) +- Fix error handling on lseek (bz 1733887) + +* Thu Jul 18 2019 Alice Mitchell 2.3.3-22 +- Revert the forced chmod of nfs.conf as unneccessary (bz 1687496) + +* Mon Jul 15 2019 Steve Dickson 2.3.3-21 +- Gating tests: run tests from tests namespace (bz 1653927) + +* Tue Jul 9 2019 Steve Dickson 2.3.3-20 +- Gating tests: Fix _env data and source it in every test run (bz 1653927) + +* Fri May 3 2019 Steve Dickson 2.3.3-19 +- Removed resource leaks found by coverity scans (bz 1602633) + +* Thu Apr 25 2019 Steve Dickson 2.3.3-18 +- Modify nfs.conf in-place instead of replacing the file (bz 1687496) + +* Tue Mar 19 2019 Steve Dickson 2.3.3-17 +- Moved the gating tests out of a patch and into the top dir (bz 1653927) +- Move the mode corrections on /etc/nfs.conf to nfsconvert.py (bz 1655880) +- gssd: add verbosity options to the rpc.gssd man page (bz 1668026) + +* Fri Mar 8 2019 Steve Dickson 2.3.3-16 +- Add a conversion for new sm-notify force option in nfs.conf (bz 1677576) +- Correct the modes on /etc/nfs.conf after a conversion (bz 1655880) + +* Tue Mar 5 2019 Steve Dickson 2.3.3-15 +- nfs.conf: Fixed manage-gids option typo (bz 1672395) +- sm-notify: Added -f flag to nfs.conf parsing (bz 1677576) +- Add nfs.conf equivalent for the statd --no-notify cmdline option (bz 1683714) * Wed Feb 13 2019 Steve Dickson 2.3.3-14 - Fix typo in checking for the 65534 uid/gid (bz 1655960)