From 4e6e523e1e2234d70274a35e8bcc3f4d003eb2db Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Apr 10 2018 05:47:38 +0000 Subject: import nfs-utils-1.3.0-0.54.el7 --- diff --git a/SOURCES/nfs-utils-1.3.0-mount-nfsvers.patch b/SOURCES/nfs-utils-1.3.0-mount-nfsvers.patch new file mode 100644 index 0000000..c100856 --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-mount-nfsvers.patch @@ -0,0 +1,36 @@ +diff -up nfs-utils-1.3.0/utils/mount/configfile.c.orig nfs-utils-1.3.0/utils/mount/configfile.c +--- nfs-utils-1.3.0/utils/mount/configfile.c.orig 2017-10-05 11:44:08.775077208 -0400 ++++ nfs-utils-1.3.0/utils/mount/configfile.c 2017-10-05 11:49:50.811349443 -0400 +@@ -70,6 +70,7 @@ struct mnt_alias { + {"background", "bg", MNT_NOARG}, + {"foreground", "fg", MNT_NOARG}, + {"sloppy", "sloppy", MNT_NOARG}, ++ {"nfsvers", "vers", MNT_UNSET}, + }; + int mnt_alias_sz = (sizeof(mnt_alias_tab)/sizeof(mnt_alias_tab[0])); + +@@ -296,20 +297,21 @@ conf_parse_mntopts(char *section, char * + + list = conf_get_tag_list(section, arg); + TAILQ_FOREACH(node, &list->fields, link) { ++ /* check first if this is an alias for another option */ ++ field = mountopts_alias(node->field, &argtype); + /* + * Do not overwrite options if already exists + */ +- snprintf(buf, BUFSIZ, "%s=", node->field); ++ snprintf(buf, BUFSIZ, "%s=", field); + if (opts && strcasestr(opts, buf) != NULL) + continue; + +- if (lookup_entry(node->field) != NULL) ++ if (lookup_entry(field) != NULL) + continue; + buf[0] = '\0'; + value = conf_get_section(section, arg, node->field); + if (value == NULL) + continue; +- field = mountopts_alias(node->field, &argtype); + if (strcasecmp(value, "false") == 0) { + if (argtype != MNT_NOARG) + snprintf(buf, BUFSIZ, "no%s", field); diff --git a/SOURCES/nfs-utils-1.3.0-mount-t-nfs4.patch b/SOURCES/nfs-utils-1.3.0-mount-t-nfs4.patch new file mode 100644 index 0000000..1e25b02 --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-mount-t-nfs4.patch @@ -0,0 +1,124 @@ +diff -up nfs-utils-1.3.0/utils/mount/configfile.c.orig nfs-utils-1.3.0/utils/mount/configfile.c +--- nfs-utils-1.3.0/utils/mount/configfile.c.orig 2018-02-22 09:31:57.000000000 -0500 ++++ nfs-utils-1.3.0/utils/mount/configfile.c 2018-02-22 09:33:05.000000000 -0500 +@@ -265,7 +265,7 @@ default_value(char *mopt) + } + } else if (strncasecmp(field, "vers", strlen("vers")) == 0) { + if ((options = po_split(field)) != NULL) { +- if (!nfs_nfs_version(options, &config_default_vers)) { ++ if (!nfs_nfs_version("nfs", options, &config_default_vers)) { + xlog_warn("Unable to set default version: %s", + strerror(errno)); + +diff -up nfs-utils-1.3.0/utils/mount/network.c.orig nfs-utils-1.3.0/utils/mount/network.c +--- nfs-utils-1.3.0/utils/mount/network.c.orig 2018-02-22 09:31:57.000000000 -0500 ++++ nfs-utils-1.3.0/utils/mount/network.c 2018-02-22 09:33:05.000000000 -0500 +@@ -1253,7 +1253,7 @@ nfs_nfs_program(struct mount_options *op + * or FALSE if the option was specified with an invalid value. + */ + int +-nfs_nfs_version(struct mount_options *options, struct nfs_version *version) ++nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *version) + { + char *version_key, *version_val, *cptr; + int i, found = 0; +@@ -1268,10 +1268,11 @@ nfs_nfs_version(struct mount_options *op + } + } + +- if (!found) ++ if (!found && strcmp(type, "nfs4") == 0) ++ version_val = type + 3; ++ else if (!found) + return 1; +- +- if (i <= 2 ) { ++ else if (i <= 2 ) { + /* v2, v3, v4 */ + version_val = version_key + 1; + version->v_mode = V_SPECIFIC; +@@ -1648,7 +1649,7 @@ int nfs_options2pmap(struct mount_option + + if (!nfs_nfs_program(options, &nfs_pmap->pm_prog)) + return 0; +- if (!nfs_nfs_version(options, &version)) ++ if (!nfs_nfs_version("nfs", options, &version)) + return 0; + nfs_pmap->pm_vers = version.major; + if (!nfs_nfs_protocol(options, &nfs_pmap->pm_prot)) +diff -up nfs-utils-1.3.0/utils/mount/network.h.orig nfs-utils-1.3.0/utils/mount/network.h +--- nfs-utils-1.3.0/utils/mount/network.h.orig 2018-02-22 09:31:57.000000000 -0500 ++++ nfs-utils-1.3.0/utils/mount/network.h 2018-02-22 09:33:05.000000000 -0500 +@@ -72,7 +72,7 @@ struct nfs_version { + + int nfs_nfs_proto_family(struct mount_options *options, sa_family_t *family); + int nfs_mount_proto_family(struct mount_options *options, sa_family_t *family); +-int nfs_nfs_version(struct mount_options *options, struct nfs_version *version); ++int nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *version); + int nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol); + + int nfs_options2pmap(struct mount_options *, +diff -up nfs-utils-1.3.0/utils/mount/nfsumount.c.orig nfs-utils-1.3.0/utils/mount/nfsumount.c +--- nfs-utils-1.3.0/utils/mount/nfsumount.c.orig 2018-02-22 09:31:57.000000000 -0500 ++++ nfs-utils-1.3.0/utils/mount/nfsumount.c 2018-02-22 09:33:05.000000000 -0500 +@@ -180,7 +180,7 @@ static int nfs_umount_is_vers4(const str + options = po_split(pmc->m.mnt_opts); + if (options != NULL) { + struct nfs_version version; +- int rc = nfs_nfs_version(options, &version); ++ int rc = nfs_nfs_version("nfs", options, &version); + po_destroy(options); + if (rc && version.major == 4) + goto out_nfs4; +diff -up nfs-utils-1.3.0/utils/mount/stropts.c.orig nfs-utils-1.3.0/utils/mount/stropts.c +--- nfs-utils-1.3.0/utils/mount/stropts.c.orig 2018-02-22 09:31:57.000000000 -0500 ++++ nfs-utils-1.3.0/utils/mount/stropts.c 2018-02-22 09:33:05.000000000 -0500 +@@ -87,8 +87,8 @@ extern int sloppy; + + struct nfsmount_info { + const char *spec, /* server:/path */ +- *node, /* mounted-on dir */ +- *type; /* "nfs" or "nfs4" */ ++ *node; /* mounted-on dir */ ++ char *type; /* "nfs" or "nfs4" */ + char *hostname; /* server's hostname */ + struct addrinfo *address; /* server's addresses */ + sa_family_t family; /* Address family */ +@@ -326,15 +326,9 @@ static int nfs_append_sloppy_option(stru + + static int nfs_set_version(struct nfsmount_info *mi) + { +- if (!nfs_nfs_version(mi->options, &mi->version)) ++ if (!nfs_nfs_version(mi->type, mi->options, &mi->version)) + return 0; + +- if (strncmp(mi->type, "nfs4", 4) == 0) { +- /* Set to default values */ +- mi->version.major = NFS_DEFAULT_MAJOR; +- mi->version.minor = NFS_DEFAULT_MINOR; +- mi->version.v_mode = V_GENERAL; +- } + /* + * Before 2.6.32, the kernel NFS client didn't + * support "-t nfs vers=4" mounts, so NFS version +@@ -1182,7 +1176,7 @@ static int nfsmount_start(struct nfsmoun + * + * Returns a valid mount command exit code. + */ +-int nfsmount_string(const char *spec, const char *node, const char *type, ++int nfsmount_string(const char *spec, const char *node, char *type, + int flags, char **extra_opts, int fake, int child) + { + struct nfsmount_info mi = { +diff -up nfs-utils-1.3.0/utils/mount/stropts.h.orig nfs-utils-1.3.0/utils/mount/stropts.h +--- nfs-utils-1.3.0/utils/mount/stropts.h.orig 2014-03-25 11:12:07.000000000 -0400 ++++ nfs-utils-1.3.0/utils/mount/stropts.h 2018-02-22 09:33:05.000000000 -0500 +@@ -24,7 +24,7 @@ + #ifndef _NFS_UTILS_MOUNT_STROPTS_H + #define _NFS_UTILS_MOUNT_STROPTS_H + +-int nfsmount_string(const char *, const char *, const char *, int, ++int nfsmount_string(const char *, const char *, char *, int, + char **, int, int); + + #endif /* _NFS_UTILS_MOUNT_STROPTS_H */ diff --git a/SOURCES/nfs-utils-1.3.0-mountstats-shebang.patch b/SOURCES/nfs-utils-1.3.0-mountstats-shebang.patch new file mode 100644 index 0000000..4217191 --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-mountstats-shebang.patch @@ -0,0 +1,22 @@ +commit a1f89c17f529b688ce3f686a48a49cb3789807c5 +Author: Steve Dickson +Date: Thu Jul 27 10:35:55 2017 -0400 + + mountstats: Remove a shebang + + There might be an issue that the script is executed with unwanted + version of . + + Signed-off-by: Steve Dickson + (cherry picked from commit caa59a30b78dedea99a2317da95bb86810360645) + +diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py +index 90b15a5..1dd1f1b 100644 +--- a/tools/mountstats/mountstats.py ++++ b/tools/mountstats/mountstats.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python + # -*- python-mode -*- + """Parse /proc/self/mountstats and display it in human readable form + """ diff --git a/SOURCES/nfs-utils-1.3.0-nfs-iostat-no-dev.patch b/SOURCES/nfs-utils-1.3.0-nfs-iostat-no-dev.patch new file mode 100644 index 0000000..edfe58a --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-nfs-iostat-no-dev.patch @@ -0,0 +1,12 @@ +diff -up nfs-utils-1.3.0/tools/nfs-iostat/nfs-iostat.py.orig nfs-utils-1.3.0/tools/nfs-iostat/nfs-iostat.py +--- nfs-utils-1.3.0/tools/nfs-iostat/nfs-iostat.py.orig 2017-11-03 09:29:39.000000000 -0400 ++++ nfs-utils-1.3.0/tools/nfs-iostat/nfs-iostat.py 2017-11-03 09:34:25.000000000 -0400 +@@ -434,6 +434,8 @@ def parse_stats_file(filename): + words = line.split() + if len(words) == 0: + continue ++ if line.startswith("no device mounted") : ++ continue + if words[0] == 'device': + key = words[4] + new = [ line.strip() ] diff --git a/SOURCES/nfs-utils-1.3.0-nfs-man-v2.patch b/SOURCES/nfs-utils-1.3.0-nfs-man-v2.patch new file mode 100644 index 0000000..0496be5 --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-nfs-man-v2.patch @@ -0,0 +1,103 @@ +diff -up nfs-utils-1.3.0/utils/exportfs/exports.man.orig nfs-utils-1.3.0/utils/exportfs/exports.man +--- nfs-utils-1.3.0/utils/exportfs/exports.man.orig 2017-11-03 07:45:47.000000000 -0400 ++++ nfs-utils-1.3.0/utils/exportfs/exports.man 2017-11-03 09:25:47.000000000 -0400 +@@ -410,7 +410,7 @@ of the filesystem must be handled elsewh + + .TP + .IR pnfs +-This option allows enables the use of pNFS extension if protocol level ++This option enables the use of the pNFS extension if the protocol level + is NFSv4.1 or higher, and the filesystem supports pNFS exports. With + pNFS clients can bypass the server and perform I/O directly to storage + devices. The default can be explicitly requested with the +diff -up nfs-utils-1.3.0/utils/mount/nfs.man.orig nfs-utils-1.3.0/utils/mount/nfs.man +--- nfs-utils-1.3.0/utils/mount/nfs.man.orig 2017-11-03 07:45:47.000000000 -0400 ++++ nfs-utils-1.3.0/utils/mount/nfs.man 2017-11-03 09:23:20.000000000 -0400 +@@ -11,11 +11,8 @@ NFS is an Internet Standard protocol + created by Sun Microsystems in 1984. NFS was developed + to allow file sharing between systems residing + on a local area network. +-The Linux NFS client supports three versions +-of the NFS protocol: +-NFS version 2 [RFC1094], +-NFS version 3 [RFC1813], +-and NFS version 4 [RFC3530]. ++Depending on kernel configuration, the Linux NFS client may ++support NFS versions 2, 3, 4.0, 4.1, or 4.2. + .P + The + .BR mount (8) +@@ -88,9 +85,8 @@ These options are valid to use with any + The NFS protocol version number used to contact the server's NFS service. + If the server does not support the requested version, the mount request + fails. +-If this option is not specified, the client negotiates a suitable version +-with +-the server, trying version 4 first, version 3 second, and version 2 last. ++If this option is not specified, the client tries version 4.1 first, ++then negotiates down until it finds a version supported by the server. + .TP 1.5i + .BI vers= n + This option is an alternative to the +@@ -752,7 +748,7 @@ NOTE: When used together, the 'local_loc + by 'nolock'/'lock' mount option. + .SS "Options for NFS version 4 only" + Use these options, along with the options in the first subsection above, +-for NFS version 4 and newer. ++for NFS version 4.0 and newer. + .TP 1.5i + .BI proto= netid + The +@@ -825,7 +821,7 @@ the behavior of this option in more deta + Specifies a single IPv4 address (in dotted-quad form), + or a non-link-local IPv6 address, + that the NFS client advertises to allow servers +-to perform NFS version 4 callback requests against ++to perform NFS version 4.0 callback requests against + files on this mount point. If the server is unable to + establish callback connections to clients, performance + may degrade, or accesses to files may temporarily hang. +@@ -838,6 +834,11 @@ In the presence of multiple client netwo + special routing policies, + or atypical network topologies, + the exact address to use for callbacks may be nontrivial to determine. ++.IP ++NFS protocol versions 4.1 and 4.2 use the client-established ++TCP connection for callback requests, so do not require the server to ++connect to the client. This option is therefore only affect NFS version ++4.0 mounts. + .TP 1.5i + .BR migration " / " nomigration + Selects whether the client uses an identification string that is compatible +@@ -1726,7 +1727,7 @@ file system table + .TP 1.5i + .I /etc/nfsmount.conf + Configuration file for NFS mounts +-.SH BUGS ++.SH NOTES + Before 2.4.7, the Linux NFS client did not support NFS over TCP. + .P + Before 2.4.20, the Linux NFS client used a heuristic +@@ -1745,9 +1746,9 @@ when the + .BR rsize " and " wsize + settings were smaller than the system's page size. + .P +-The Linux NFS client does not yet support +-certain optional features of the NFS version 4 protocol, +-such as security negotiation, server referrals, and named attributes. ++The Linux client's support for protocol versions depend on whether the ++kernel was built with options CONFIG_NFS_V2, CONFIG_NFS_V3, ++CONFIG_NFS_V4, CONFIG_NFS_V4_1, and CONFIG_NFS_V4_2. + .SH "SEE ALSO" + .BR fstab (5), + .BR mount (8), +@@ -1780,4 +1781,8 @@ RFC 1833 for the RPC bind specification. + .br + RFC 2203 for the RPCSEC GSS API protocol specification. + .br +-RFC 3530 for the NFS version 4 specification. ++RFC 7530 for the NFS version 4.0 specification. ++.br ++RFC 5661 for the NFS version 4.1 specification. ++.br ++RFC 7862 for the NFS version 4.2 specification. diff --git a/SOURCES/nfs-utils-1.3.0-nfsdcltrack-invalops.patch b/SOURCES/nfs-utils-1.3.0-nfsdcltrack-invalops.patch new file mode 100644 index 0000000..f3d07a2 --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-nfsdcltrack-invalops.patch @@ -0,0 +1,12 @@ +diff -up nfs-utils-1.3.0/utils/nfsdcltrack/nfsdcltrack.c.orig nfs-utils-1.3.0/utils/nfsdcltrack/nfsdcltrack.c +--- nfs-utils-1.3.0/utils/nfsdcltrack/nfsdcltrack.c.orig 2017-10-12 12:46:02.785182594 -0400 ++++ nfs-utils-1.3.0/utils/nfsdcltrack/nfsdcltrack.c 2017-10-12 13:30:35.756186324 -0400 +@@ -591,7 +591,7 @@ main(int argc, char **argv) + break; + default: + usage(progname); +- return 0; ++ return 1; + } + } + diff --git a/SOURCES/nfs-utils-1.3.0-nfsdcltrack-warning01.patch b/SOURCES/nfs-utils-1.3.0-nfsdcltrack-warning01.patch new file mode 100644 index 0000000..6a2ed40 --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-nfsdcltrack-warning01.patch @@ -0,0 +1,24 @@ +commit d6ee36b8dcc663dc2b797d51e553f390ea2f7e31 +Author: Steve Dickson +Date: Wed Jul 19 16:42:39 2017 -0400 + + nfsdcltrack.c: remove a warning + + nfsdcltrack.c:581:4: warning: this statement may fall through [-Wimplicit-fallthrough=] + + Acked-by: Jeff Layton + Signed-off-by: Steve Dickson + (cherry picked from commit f80c9984339da6f689f330b8a83d5ee503126827) + +diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c +index 7af9efb..2f58f96 100644 +--- a/utils/nfsdcltrack/nfsdcltrack.c ++++ b/utils/nfsdcltrack/nfsdcltrack.c +@@ -581,6 +581,7 @@ main(int argc, char **argv) + switch (arg) { + case 'd': + xlog_config(D_ALL, 1); ++ break; + case 'f': + xlog_syslog(0); + xlog_stderr(1); diff --git a/SOURCES/nfs-utils-1.3.0-server-chgrpcpipefs.patch b/SOURCES/nfs-utils-1.3.0-server-chgrpcpipefs.patch new file mode 100644 index 0000000..473fab8 --- /dev/null +++ b/SOURCES/nfs-utils-1.3.0-server-chgrpcpipefs.patch @@ -0,0 +1,935 @@ +diff --git a/.gitignore b/.gitignore +index 3d9640d..d26f4be 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -70,6 +70,8 @@ tests/nsm_client/nlm_sm_inter_svc.c + tests/nsm_client/nlm_sm_inter_xdr.c + utils/nfsidmap/nfsidmap + systemd/nfs-server-generator ++systemd/rpc-pipefs-generator ++systemd/rpc-gssd.service + # cscope database files + cscope.* + # generic editor backup et al +diff --git a/configure.ac b/configure.ac +index 3bce774..fce0e15 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -498,8 +498,14 @@ AC_SUBST([AM_CFLAGS], ["$my_am_cflags"]) + # Make sure that $ACLOCAL_FLAGS are used during a rebuild + AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"]) + ++# make _sysconfdir available for substituion in config files ++# 2 "evals" needed late to expand variable names. ++AC_SUBST([_sysconfdir]) ++AC_CONFIG_COMMANDS_PRE([eval eval _sysconfdir=$sysconfdir]) ++ + AC_CONFIG_FILES([ + Makefile ++ systemd/rpc-gssd.service + linux-nfs/Makefile + support/Makefile + support/export/Makefile +diff --git a/nfs.conf b/nfs.conf +index c907de6..89cf386 100644 +--- a/nfs.conf ++++ b/nfs.conf +@@ -1,7 +1,10 @@ + # +-# This is a general conifguration for the ++# This is a general configuration for the + # NFS daemons and tools + # ++#[general] ++# pipefs-directory=/var/lib/nfs/rpc_pipefs ++# + #[exportfs] + # debug=0 + # +@@ -12,7 +15,6 @@ + # limit-to-legacy-enctypes=0 + # context-timeout=0 + # rpc-timeout=5 +-# pipefs-directory=/var/lib/nfs/rpc_pipefs + # keytab-file=/etc/krb5.keytab + # cred-cache-directory= + # preferred-realm= +diff --git a/support/include/xcommon.h b/support/include/xcommon.h +index d1a4b18..23c9a13 100644 +--- a/support/include/xcommon.h ++++ b/support/include/xcommon.h +@@ -17,6 +17,12 @@ + #include + #include + ++#ifdef MAJOR_IN_MKDEV ++#include ++#elif defined(MAJOR_IN_SYSMACROS) ++#include ++#endif ++ + #define streq(s, t) (strcmp ((s), (t)) == 0) + + /* Functions in sundries.c that are used in mount.c and umount.c */ +diff --git a/support/nfs/nfsexport.c b/support/nfs/nfsexport.c +index f129fd2..c1c736e 100644 +--- a/support/nfs/nfsexport.c ++++ b/support/nfs/nfsexport.c +@@ -18,6 +18,7 @@ + #include + + #include "nfslib.h" ++#include "xcommon.h" + + /* if /proc/net/rpc/... exists, then + * write to it, as that interface is more stable. +diff --git a/systemd/Makefile.am b/systemd/Makefile.am +index b789916..54a3b64 100644 +--- a/systemd/Makefile.am ++++ b/systemd/Makefile.am +@@ -8,6 +8,7 @@ unit_files = \ + nfs-blkmap.service \ + nfs-config.service \ + nfs-idmapd.service \ ++ rpc_pipefs.target \ + nfs-mountd.service \ + nfs-server.service \ + nfs-utils.service \ +@@ -24,14 +25,23 @@ EXTRA_DIST = $(unit_files) $(man5_MANS) $(man7_MANS) + unit_dir = /usr/lib/systemd/system + generator_dir = /usr/lib/systemd/system-generators + +-EXTRA_PROGRAMS = nfs-server-generator ++EXTRA_PROGRAMS = nfs-server-generator rpc-pipefs-generator + genexecdir = $(generator_dir) ++ ++COMMON_SRCS = systemd.c systemd.h ++ ++nfs_server_generator_SOURCES = $(COMMON_SRCS) nfs-server-generator.c ++ ++rpc_pipefs_generator_SOURCES = $(COMMON_SRCS) rpc-pipefs-generator.c ++ + nfs_server_generator_LDADD = ../support/export/libexport.a \ + ../support/nfs/libnfs.a \ + ../support/misc/libmisc.a + ++rpc_pipefs_generator_LDADD = ../support/nfs/libnfs.a ++ + if INSTALL_SYSTEMD +-genexec_PROGRAMS = nfs-server-generator ++genexec_PROGRAMS = nfs-server-generator rpc-pipefs-generator + install-data-hook: $(unit_files) + mkdir -p $(DESTDIR)/$(unitdir) + cp $(unit_files) $(DESTDIR)/$(unitdir) +diff --git a/systemd/nfs-blkmap.service b/systemd/nfs-blkmap.service +index ddbf4e9..c844e2d 100644 +--- a/systemd/nfs-blkmap.service ++++ b/systemd/nfs-blkmap.service +@@ -2,8 +2,8 @@ + Description=pNFS block layout mapping daemon + DefaultDependencies=no + Conflicts=umount.target +-After=var-lib-nfs-rpc_pipefs.mount +-Requires=var-lib-nfs-rpc_pipefs.mount ++After=rpc_pipefs.target ++Requires=rpc_pipefs.target + + PartOf=nfs-utils.service + +diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service +index df3dd9d..38685b6 100644 +--- a/systemd/nfs-idmapd.service ++++ b/systemd/nfs-idmapd.service +@@ -1,8 +1,8 @@ + [Unit] + Description=NFSv4 ID-name mapping service + DefaultDependencies=no +-Requires=var-lib-nfs-rpc_pipefs.mount +-After=var-lib-nfs-rpc_pipefs.mount local-fs.target ++Requires=rpc_pipefs.target ++After=rpc_pipefs.target local-fs.target + + BindsTo=nfs-server.service + +diff --git a/systemd/nfs-server-generator.c b/systemd/nfs-server-generator.c +index 4aa6509..737f109 100644 +--- a/systemd/nfs-server-generator.c ++++ b/systemd/nfs-server-generator.c +@@ -29,6 +29,7 @@ + #include "misc.h" + #include "nfslib.h" + #include "exportfs.h" ++#include "systemd.h" + + /* A simple "set of strings" to remove duplicates + * found in /etc/exports +@@ -55,35 +56,6 @@ static int is_unique(struct list **lp, char *path) + return 1; + } + +-/* We need to convert a path name to a systemd unit +- * name. This requires some translation ('/' -> '-') +- * and some escaping. +- */ +-static void systemd_escape(FILE *f, char *path) +-{ +- while (*path == '/') +- path++; +- if (!*path) { +- /* "/" becomes "-", otherwise leading "/" is ignored */ +- fputs("-", f); +- return; +- } +- while (*path) { +- char c = *path++; +- +- if (c == '/') { +- /* multiple non-trailing slashes become '-' */ +- while (*path == '/') +- path++; +- if (*path) +- fputs("-", f); +- } else if (isalnum(c) || c == ':' || c == '.') +- fputc(c, f); +- else +- fprintf(f, "\\x%02x", c & 0xff); +- } +-} +- + static int has_noauto_flag(char *path) + { + FILE *fstab; +@@ -108,7 +80,7 @@ static int has_noauto_flag(char *path) + + int main(int argc, char *argv[]) + { +- char *path; ++ char *path, *spath; + char dirbase[] = "/nfs-server.service.d"; + char filebase[] = "/order-with-mounts.conf"; + nfs_export *exp; +@@ -167,9 +139,15 @@ int main(int argc, char *argv[]) + if (strcmp(mnt->mnt_type, "nfs") != 0 && + strcmp(mnt->mnt_type, "nfs4") != 0) + continue; +- fprintf(f, "Before= "); +- systemd_escape(f, mnt->mnt_dir); +- fprintf(f, ".mount\n"); ++ ++ spath = systemd_escape(mnt->mnt_dir, ".mount"); ++ if (!spath) { ++ fprintf(stderr, ++ "nfs-server-generator: convert path failed: %s\n", ++ mnt->mnt_dir); ++ continue; ++ } ++ fprintf(f, "Before=%s\n", spath); + } + + fclose(fstab); +diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man +index 938b970..9700586 100644 +--- a/systemd/nfs.conf.man ++++ b/systemd/nfs.conf.man +@@ -96,6 +96,18 @@ value, which can be one or more from the list + .BR all . + When a list is given, the members should be comma-separated. + .TP ++.B general ++Recognized values: ++.BR pipefs-directory . ++ ++See ++.BR blkmapd (8), ++.BR rpc.idmapd (8), ++and ++.BR rpc.gssd (8) ++for details. ++ ++.TP + .B nfsdcltrack + Recognized values: + .BR storagedir . +@@ -198,7 +210,6 @@ Recognized values: + .BR limit-to-legacy-enctypes , + .BR context-timeout , + .BR rpc-timeout , +-.BR pipefs-directory , + .BR keytab-file , + .BR cred-cache-directory , + .BR preferred-realm . +diff --git a/systemd/rpc-gssd.service b/systemd/rpc-gssd.service +deleted file mode 100644 +index 5d6d09f..0000000 +--- a/systemd/rpc-gssd.service ++++ /dev/null +@@ -1,19 +0,0 @@ +-[Unit] +-Description=RPC security service for NFS client and server +-DefaultDependencies=no +-Conflicts=umount.target +-Requires=var-lib-nfs-rpc_pipefs.mount +-After=var-lib-nfs-rpc_pipefs.mount gssproxy.service +- +-ConditionPathExists=/etc/krb5.keytab +- +-PartOf=nfs-utils.service +- +-Wants=nfs-config.service +-After=nfs-config.service +- +-[Service] +-EnvironmentFile=-/run/sysconfig/nfs-utils +- +-Type=forking +-ExecStart=/usr/sbin/rpc.gssd $GSSDARGS +diff --git a/systemd/rpc-gssd.service.in b/systemd/rpc-gssd.service.in +new file mode 100644 +index 0000000..c75ccbd +--- /dev/null ++++ b/systemd/rpc-gssd.service.in +@@ -0,0 +1,19 @@ ++[Unit] ++Description=RPC security service for NFS client and server ++DefaultDependencies=no ++Conflicts=umount.target ++Requires=rpc_pipefs.target ++After=rpc_pipefs.target gssproxy.service ++ ++ConditionPathExists=@_sysconfdir@/krb5.keytab ++ ++PartOf=nfs-utils.service ++ ++Wants=nfs-config.service ++After=nfs-config.service ++ ++[Service] ++EnvironmentFile=-/run/sysconfig/nfs-utils ++ ++Type=forking ++ExecStart=/usr/sbin/rpc.gssd $GSSDARGS +diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c +new file mode 100644 +index 0000000..66addb9 +--- /dev/null ++++ b/systemd/rpc-pipefs-generator.c +@@ -0,0 +1,138 @@ ++/* ++ * rpc-pipefs-generator: ++ * systemd generator to create ordering dependencies between ++ * nfs services and the rpc_pipefs mountpoint ++ */ ++ ++#ifdef HAVE_CONFIG_H ++#include ++#endif ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "nfslib.h" ++#include "conffile.h" ++#include "systemd.h" ++ ++#define RPC_PIPEFS_DEFAULT "/var/lib/nfs/rpc_pipefs" ++char *conf_path = NFS_CONFFILE; ++ ++static int generate_mount_unit(const char *pipefs_path, const char *pipefs_unit, ++ const char *dirname) ++{ ++ char *path; ++ FILE *f; ++ ++ path = malloc(strlen(dirname) + 1 + strlen(pipefs_unit)); ++ if (!path) ++ return 1; ++ sprintf(path, "%s/%s", dirname, pipefs_unit); ++ f = fopen(path, "w"); ++ if (!f) ++ return 1; ++ ++ fprintf(f, "# Automatically generated by rpc-pipefs-generator\n\n[Unit]\n"); ++ fprintf(f, "Description=RPC Pipe File System\n"); ++ fprintf(f, "DefaultDependencies=no\n"); ++ fprintf(f, "After=systemd-tmpfiles-setup.service\n"); ++ fprintf(f, "Conflicts=umount.target\n"); ++ fprintf(f, "\n[Mount]\n"); ++ fprintf(f, "What=sunrpc\n"); ++ fprintf(f, "Where=%s\n", pipefs_path); ++ fprintf(f, "Type=rpc_pipefs\n"); ++ ++ fclose(f); ++ return 0; ++} ++ ++static ++int generate_target(char *pipefs_path, const char *dirname) ++{ ++ char *path; ++ char filebase[] = "/rpc_pipefs.target"; ++ char *pipefs_unit; ++ FILE *f; ++ int ret = 0; ++ ++ pipefs_unit = systemd_escape(pipefs_path, ".mount"); ++ if (!pipefs_unit) ++ return 1; ++ ++ ret = generate_mount_unit(pipefs_path, pipefs_unit, dirname); ++ if (ret) ++ return ret; ++ ++ path = malloc(strlen(dirname) + 1 + sizeof(filebase)); ++ if (!path) ++ return 2; ++ sprintf(path, "%s", dirname); ++ mkdir(path, 0755); ++ strcat(path, filebase); ++ f = fopen(path, "w"); ++ if (!f) ++ return 1; ++ ++ fprintf(f, "# Automatically generated by rpc-pipefs-generator\n\n[Unit]\n"); ++ fprintf(f, "Requires=%s\n", pipefs_unit); ++ fprintf(f, "After=%s\n", pipefs_unit); ++ fclose(f); ++ ++ return 0; ++} ++ ++static int is_non_pipefs_mountpoint(char *path) ++{ ++ FILE *mtab; ++ struct mntent *mnt; ++ ++ mtab = setmntent("/etc/mtab", "r"); ++ if (!mtab) ++ return 0; ++ ++ while ((mnt = getmntent(mtab)) != NULL) { ++ if (strlen(mnt->mnt_dir) != strlen(path)) ++ continue; ++ if (strncmp(mnt->mnt_dir, path, strlen(mnt->mnt_dir))) ++ continue; ++ if (strncmp(mnt->mnt_type, "rpc_pipefs", strlen(mnt->mnt_type))) ++ break; ++ } ++ fclose(mtab); ++ return mnt != NULL; ++} ++ ++int main(int argc, char *argv[]) ++{ ++ int ret; ++ char *s; ++ ++ /* Avoid using any external services */ ++ xlog_syslog(0); ++ ++ if (argc != 4 || argv[1][0] != '/') { ++ fprintf(stderr, "rpc-pipefs-generator: create systemd dependencies for nfs services\n"); ++ fprintf(stderr, "Usage: normal-dir early-dir late-dir\n"); ++ exit(1); ++ } ++ ++ conf_init(); ++ s = conf_get_str("general", "pipefs-directory"); ++ if (!s) ++ exit(0); ++ if (strlen(s) == strlen(RPC_PIPEFS_DEFAULT) && ++ strcmp(s, RPC_PIPEFS_DEFAULT) == 0) ++ exit(0); ++ ++ if (is_non_pipefs_mountpoint(s)) ++ exit(1); ++ ++ ret = generate_target(s, argv[1]); ++ exit(ret); ++} +diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service +index 41177b6..a3a555c 100644 +--- a/systemd/rpc-svcgssd.service ++++ b/systemd/rpc-svcgssd.service +@@ -1,8 +1,7 @@ + [Unit] + Description=RPC security service for NFS server + DefaultDependencies=no +-Requires=var-lib-nfs-rpc_pipefs.mount +-After=var-lib-nfs-rpc_pipefs.mount local-fs.target ++After=local-fs.target + PartOf=nfs-server.service + PartOf=nfs-utils.service + +diff --git a/systemd/rpc_pipefs.target b/systemd/rpc_pipefs.target +new file mode 100644 +index 0000000..01d4d27 +--- /dev/null ++++ b/systemd/rpc_pipefs.target +@@ -0,0 +1,3 @@ ++[Unit] ++Requires=var-lib-nfs-rpc_pipefs.mount ++After=var-lib-nfs-rpc_pipefs.mount +diff --git a/systemd/systemd.c b/systemd/systemd.c +new file mode 100644 +index 0000000..17820d4 +--- /dev/null ++++ b/systemd/systemd.c +@@ -0,0 +1,133 @@ ++/* ++ * Helper functions for systemd generators in nfs-utils. ++ * ++ * Currently just systemd_escape(). ++ */ ++ ++#include ++#include ++#include ++#include ++ ++static const char hex[16] = ++{ ++ '0', '1', '2', '3', '4', '5', '6', '7', ++ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', ++}; ++ ++/* ++ * determine length of the string that systemd_escape() needs to allocate ++ */ ++static int systemd_len(char *path) ++{ ++ char *p; ++ int len = 0; ++ ++ p = path; ++ while (*p == '/') ++ /* multiple leading "/" are ignored */ ++ p++; ++ ++ if (!*p) ++ /* root directory "/" becomes is encoded as a single "-" */ ++ return 1; ++ ++ if (*p == '.') ++ /* ++ * replace "." with "\x2d" escape sequence if ++ * it's the first character in escaped path ++ * */ ++ len += 4; ++ ++ while (*p) { ++ unsigned char c = *p++; ++ ++ if (c == '/') { ++ /* multiple non-trailing slashes become '-' */ ++ while (*p == '/') ++ p++; ++ if (*p) ++ len++; ++ } else if (isalnum(c) || c == ':' || c == '.' || c == '_') ++ /* these characters are not replaced */ ++ len++; ++ else ++ /* replace with "\x2d" escape sequence */ ++ len += 4; ++ } ++ ++ return len; ++} ++ ++/* ++ * convert c to "\x2d" escape sequence and append to string ++ * at position p, advancing p ++ */ ++static char *hexify(unsigned char c, char *p) ++{ ++ *p++ = '\\'; ++ *p++ = 'x'; ++ *p++ = hex[c >> 4]; ++ *p++ = hex[c & 0xf]; ++ return p; ++} ++ ++/* ++ * convert a path to a unit name according to the logic in systemd.unit(5): ++ * ++ * Basically, given a path, "/" is replaced by "-", and all other ++ * characters which are not ASCII alphanumerics are replaced by C-style ++ * "\x2d" escapes (except that "_" is never replaced and "." is only ++ * replaced when it would be the first character in the escaped path). ++ * The root directory "/" is encoded as single dash, while otherwise the ++ * initial and ending "/" are removed from all paths during ++ * transformation. ++ * ++ * NB: Although the systemd.unit(5) doesn't mention it, the ':' character ++ * is not escaped. ++ */ ++char *systemd_escape(char *path, char *suffix) ++{ ++ char *result; ++ char *p; ++ int len; ++ ++ len = systemd_len(path); ++ result = malloc(len + strlen(suffix) + 1); ++ p = result; ++ while (*path == '/') ++ /* multiple leading "/" are ignored */ ++ path++; ++ if (!*path) { ++ /* root directory "/" becomes is encoded as a single "-" */ ++ *p++ = '-'; ++ goto out; ++ } ++ if (*path == '.') ++ /* ++ * replace "." with "\x2d" escape sequence if ++ * it's the first character in escaped path ++ * */ ++ p = hexify(*path++, p); ++ ++ while (*path) { ++ unsigned char c = *path++; ++ ++ if (c == '/') { ++ /* multiple non-trailing slashes become '-' */ ++ while (*path == '/') ++ path++; ++ if (*path) ++ *p++ = '-'; ++ } else if (isalnum(c) || c == ':' || c == '.' || c == '_') ++ /* these characters are not replaced */ ++ *p++ = c; ++ else ++ /* replace with "\x2d" escape sequence */ ++ p = hexify(c, p); ++ } ++ ++out: ++ sprintf(p, "%s", suffix); ++ return result; ++} +diff --git a/systemd/systemd.h b/systemd/systemd.h +new file mode 100644 +index 0000000..25235ec +--- /dev/null ++++ b/systemd/systemd.h +@@ -0,0 +1,6 @@ ++#ifndef SYSTEMD_H ++#define SYSTEMD_H ++ ++char *systemd_escape(char *path, char *suffix); ++ ++#endif /* SYSTEMD_H */ +diff --git a/utils/blkmapd/blkmapd.man b/utils/blkmapd/blkmapd.man +index 914b80f..4b3d3f0 100644 +--- a/utils/blkmapd/blkmapd.man ++++ b/utils/blkmapd/blkmapd.man +@@ -43,9 +43,24 @@ Performs device discovery only then exits. + Runs + .B blkmapd + in the foreground and sends output to stderr (as opposed to syslogd) ++.SH CONFIGURATION FILE ++The ++.B blkmapd ++daemon recognizes the following value from the ++.B [general] ++section of the ++.I /etc/nfs.conf ++configuration file: ++.TP ++.B pipefs-directory ++Tells ++.B blkmapd ++where to look for the rpc_pipefs filesystem. The default value is ++.IR /var/lib/nfs/rpc_pipefs . + .SH SEE ALSO + .BR nfs (5), +-.BR dmsetup (8) ++.BR dmsetup (8), ++.BR nfs.conf (5) + .sp + RFC 5661 for the NFS version 4.1 specification. + .br +diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c +index b010628..a419947 100644 +--- a/utils/blkmapd/device-discovery.c ++++ b/utils/blkmapd/device-discovery.c +@@ -50,19 +50,36 @@ + #include + #include + ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif /* HAVE_CONFIG_H */ ++ + #include "device-discovery.h" ++#include "xcommon.h" ++#include "nfslib.h" ++#include "conffile.h" + + #define EVENT_SIZE (sizeof(struct inotify_event)) + #define EVENT_BUFSIZE (1024 * EVENT_SIZE) + +-#define BL_PIPE_FILE "/var/lib/nfs/rpc_pipefs/nfs/blocklayout" +-#define NFSPIPE_DIR "/var/lib/nfs/rpc_pipefs/nfs" + #define RPCPIPE_DIR "/var/lib/nfs/rpc_pipefs" + #define PID_FILE "/var/run/blkmapd.pid" + ++#define CONF_SAVE(w, f) do { \ ++ char *p = f; \ ++ if (p != NULL) \ ++ (w) = p; \ ++} while (0) ++ ++static char bl_pipe_file[PATH_MAX]; ++static char nfspipe_dir[PATH_MAX]; ++static char rpcpipe_dir[PATH_MAX]; ++ + struct bl_disk *visible_disk_list; + int bl_watch_fd, bl_pipe_fd, nfs_pipedir_wfd, rpc_pipedir_wfd; + int pidfd = -1; ++char *conf_path = NULL; ++ + + struct bl_disk_path *bl_get_path(const char *filepath, + struct bl_disk_path *paths) +@@ -357,8 +374,8 @@ static void bl_rpcpipe_cb(void) + continue; + if (event->mask & IN_CREATE) { + BL_LOG_WARNING("nfs pipe dir created\n"); +- bl_watch_dir(NFSPIPE_DIR, &nfs_pipedir_wfd); +- bl_pipe_fd = open(BL_PIPE_FILE, O_RDWR); ++ bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd); ++ bl_pipe_fd = open(bl_pipe_file, O_RDWR); + } else if (event->mask & IN_DELETE) { + BL_LOG_WARNING("nfs pipe dir deleted\n"); + inotify_rm_watch(bl_watch_fd, nfs_pipedir_wfd); +@@ -371,7 +388,7 @@ static void bl_rpcpipe_cb(void) + continue; + if (event->mask & IN_CREATE) { + BL_LOG_WARNING("blocklayout pipe file created\n"); +- bl_pipe_fd = open(BL_PIPE_FILE, O_RDWR); ++ 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)); +@@ -437,6 +454,19 @@ int main(int argc, char **argv) + int opt, dflag = 0, fg = 0, ret = 1; + struct stat statbuf; + char pidbuf[64]; ++ char *xrpcpipe_dir = NULL; ++ ++ strncpy(rpcpipe_dir, RPCPIPE_DIR, sizeof(rpcpipe_dir)); ++ conf_path = NFS_CONFFILE; ++ conf_init(); ++ CONF_SAVE(xrpcpipe_dir, conf_get_str("general", "pipefs-directory")); ++ if (xrpcpipe_dir != NULL) ++ strlcpy(rpcpipe_dir, xrpcpipe_dir, sizeof(rpcpipe_dir)); ++ ++ strncpy(nfspipe_dir, rpcpipe_dir, sizeof(nfspipe_dir)); ++ strlcat(nfspipe_dir, "/nfs", sizeof(nfspipe_dir)); ++ strncpy(bl_pipe_file, rpcpipe_dir, sizeof(bl_pipe_file)); ++ strlcat(bl_pipe_file, "/nfs/blocklayout", sizeof(bl_pipe_file)); + + while ((opt = getopt(argc, argv, "hdf")) != -1) { + switch (opt) { +@@ -501,12 +531,12 @@ int main(int argc, char **argv) + } + + /* open pipe file */ +- bl_watch_dir(RPCPIPE_DIR, &rpc_pipedir_wfd); +- bl_watch_dir(NFSPIPE_DIR, &nfs_pipedir_wfd); ++ bl_watch_dir(rpcpipe_dir, &rpc_pipedir_wfd); ++ bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd); + +- bl_pipe_fd = open(BL_PIPE_FILE, O_RDWR); ++ bl_pipe_fd = open(bl_pipe_file, O_RDWR); + if (bl_pipe_fd < 0) +- BL_LOG_ERR("open pipe file %s failed: %s\n", BL_PIPE_FILE, strerror(errno)); ++ BL_LOG_ERR("open pipe file %s failed: %s\n", bl_pipe_file, strerror(errno)); + + while (1) { + /* discover device when needed */ +diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c +index c5c03fb..10d50d3 100644 +--- a/utils/gssd/gssd.c ++++ b/utils/gssd/gssd.c +@@ -857,6 +857,10 @@ read_gss_conf(void) + s = conf_get_str("gssd", "pipefs-directory"); + if (!s) + s = conf_get_str("general", "pipefs-directory"); ++ else ++ printerr(0, "WARNING: Specifying pipefs-directory in the [gssd] " ++ "section of %s is deprecated. Use the [general] " ++ "section instead.", NFS_CONFFILE); + if (s) + pipefs_path = s; + s = conf_get_str("gssd", "keytab-file"); +diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man +index 87eef02..e620f0d 100644 +--- a/utils/gssd/gssd.man ++++ b/utils/gssd/gssd.man +@@ -335,10 +335,6 @@ Equivalent to + Equivalent to + .BR -t . + .TP +-.B pipefs-directory +-Equivalent to +-.BR -p . +-.TP + .B keytab-file + Equivalent to + .BR -k . +@@ -350,6 +346,14 @@ Equivalent to + .B preferred-realm + Equivalent to + .BR -R . ++.P ++In addtion, the following value is recognized from the ++.B [general] ++section: ++.TP ++.B pipefs-directory ++Equivalent to ++.BR -p . + + .SH SEE ALSO + .BR rpc.svcgssd (8), +diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c +index f55d2e1..03efbea 100644 +--- a/utils/idmapd/idmapd.c ++++ b/utils/idmapd/idmapd.c +@@ -166,7 +166,7 @@ static uid_t nobodyuid; + static gid_t nobodygid; + + /* Used by conffile.c in libnfs.a */ +-char *conf_path; ++char *conf_path = NULL; + + static int + flush_nfsd_cache(char *path, time_t now) +@@ -220,7 +220,6 @@ main(int argc, char **argv) + int ret; + char *progname; + +- conf_path = _PATH_IDMAPDCONF; + nobodyuser = NFS4NOBODY_USER; + nobodygroup = NFS4NOBODY_GROUP; + strlcpy(pipefsdir, PIPEFS_DIR, sizeof(pipefsdir)); +@@ -234,8 +233,11 @@ main(int argc, char **argv) + #define GETOPTSTR "hvfd:p:U:G:c:CS" + opterr=0; /* Turn off error messages */ + while ((opt = getopt(argc, argv, GETOPTSTR)) != -1) { +- if (opt == 'c') ++ if (opt == 'c') { ++ warnx("-c is deprecated and may be removed in the " ++ "future. See idmapd(8)."); + conf_path = optarg; ++ } + if (opt == '?') { + if (strchr(GETOPTSTR, optopt)) + warnx("'-%c' option requires an argument.", optopt); +@@ -247,17 +249,33 @@ main(int argc, char **argv) + } + optind = 1; + +- if (stat(conf_path, &sb) == -1 && (errno == ENOENT || errno == EACCES)) { +- warn("Skipping configuration file \"%s\"", conf_path); +- conf_path = NULL; ++ if (conf_path) { /* deprecated -c option was specified */ ++ if (stat(conf_path, &sb) == -1 && (errno == ENOENT || errno == EACCES)) { ++ warn("Skipping configuration file \"%s\"", conf_path); ++ conf_path = NULL; ++ } else { ++ conf_init(); ++ verbose = conf_get_num("General", "Verbosity", 0); ++ cache_entry_expiration = conf_get_num("General", ++ "Cache-Expiration", DEFAULT_IDMAP_CACHE_EXPIRY); ++ CONF_SAVE(xpipefsdir, conf_get_str("General", "Pipefs-Directory")); ++ if (xpipefsdir != NULL) ++ strlcpy(pipefsdir, xpipefsdir, sizeof(pipefsdir)); ++ CONF_SAVE(nobodyuser, conf_get_str("Mapping", "Nobody-User")); ++ CONF_SAVE(nobodygroup, conf_get_str("Mapping", "Nobody-Group")); ++ } + } else { ++ conf_path = NFS_CONFFILE; + conf_init(); +- verbose = conf_get_num("General", "Verbosity", 0); +- cache_entry_expiration = conf_get_num("General", +- "Cache-Expiration", DEFAULT_IDMAP_CACHE_EXPIRY); + CONF_SAVE(xpipefsdir, conf_get_str("General", "Pipefs-Directory")); + if (xpipefsdir != NULL) + strlcpy(pipefsdir, xpipefsdir, sizeof(pipefsdir)); ++ ++ conf_path = _PATH_IDMAPDCONF; ++ conf_init(); ++ verbose = conf_get_num("General", "Verbosity", 0); ++ cache_entry_expiration = conf_get_num("General", ++ "cache-expiration", DEFAULT_IDMAP_CACHE_EXPIRY); + CONF_SAVE(nobodyuser, conf_get_str("Mapping", "Nobody-User")); + CONF_SAVE(nobodygroup, conf_get_str("Mapping", "Nobody-Group")); + } +diff --git a/utils/idmapd/idmapd.man b/utils/idmapd/idmapd.man +index b9200c7..fb5fc1e 100644 +--- a/utils/idmapd/idmapd.man ++++ b/utils/idmapd/idmapd.man +@@ -50,11 +50,28 @@ The default value is \&"/var/lib/nfs/rpc_pipefs\&". + .It Fl c Ar path + Use configuration file + .Ar path . ++This option is deprecated. + .It Fl C + Client-only: perform no idmapping for any NFS server, even if one is detected. + .It Fl S + Server-only: perform no idmapping for any NFS client, even if one is detected. + .El ++.Sh CONFIGURATION FILES ++.Nm ++recognizes the following value from the ++.Sy [general] ++section of the ++.Pa /etc/nfs.conf ++configuration file: ++.Bl -tag -width Ds_imagedir ++.It Sy pipefs-directory ++Equivalent to ++.Sy -p . ++.El ++.Pp ++All other settings related to id mapping are found in the ++.Pa /etc/idmapd.conf ++configuration file. + .Sh EXAMPLES + .Cm rpc.idmapd -f -vvv + .Pp +@@ -71,9 +88,11 @@ messages to console, and with a verbosity level of 3. + .\" This next request is for sections 1, 6, 7 & 8 only. + .\" .Sh ENVIRONMENT + .Sh FILES +-.Pa /etc/idmapd.conf ++.Pa /etc/idmapd.conf , ++.Pa /etc/nfs.conf + .Sh SEE ALSO + .Xr idmapd.conf 5 , ++.Xr nfs.conf 5 , + .Xr nfsidmap 8 + .\".Sh SEE ALSO + .\".Xr nylon.conf 4 +diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c +index 3bc13ca..f23fb5a 100644 +--- a/utils/mountd/cache.c ++++ b/utils/mountd/cache.c +@@ -31,6 +31,7 @@ + #include "mountd.h" + #include "fsloc.h" + #include "pseudoflavors.h" ++#include "xcommon.h" + + #ifdef USE_BLKID + #include "blkid/blkid.h" diff --git a/SPECS/nfs-utils.spec b/SPECS/nfs-utils.spec index 81b6fbf..6dfddc0 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://sourceforge.net/projects/nfs Version: 1.3.0 -Release: 0.48%{?dist}.2 +Release: 0.54%{?dist} Epoch: 1 # group all 32bit related archs @@ -126,11 +126,19 @@ Patch095: nfs-utils-1.3.0-mount-use-minor-default.patch Patch096: nfs-utils-1.3.0-mount-restore-econn.patch Patch097: nfs-utils-1.3.0-exportfs-path-comp.patch # -# RHEL7.4-Z +# RHEL7.5 # -Patch098: nfs-utils-1.3.0-mount-addressfailed.patch -Patch099: nfs-utils-1.3.0-mount-eacces.patch -Patch100: nfs-utils-1.3.0-mount-minorversion.patch +Patch098: nfs-utils-1.3.0-mount-eacces.patch +Patch099: nfs-utils-1.3.0-mount-minorversion.patch +Patch100: nfs-utils-1.3.0-mountstats-shebang.patch +Patch101: nfs-utils-1.3.0-nfsdcltrack-warning01.patch +Patch102: nfs-utils-1.3.0-mount-addressfailed.patch +Patch103: nfs-utils-1.3.0-mount-nfsvers.patch +Patch104: nfs-utils-1.3.0-server-chgrpcpipefs.patch +Patch105: nfs-utils-1.3.0-nfsdcltrack-invalops.patch +Patch106: nfs-utils-1.3.0-nfs-man-v2.patch +Patch107: nfs-utils-1.3.0-nfs-iostat-no-dev.patch +Patch108: nfs-utils-1.3.0-mount-t-nfs4.patch Patch1000: nfs-utils-1.2.1-statdpath-man.patch Patch1001: nfs-utils-1.2.1-exp-subtree-warn-off.patch @@ -382,12 +390,28 @@ This package also contains the mount.nfs and umount.nfs program. %patch096 -p1 # 1389046 Pacemaker node fenced out due to redundant export... %patch097 -p1 -# 1498959 - RHEL7.4: service nfs-server start fails the first time... +# 1479573 - RHEL7.4: NFS mount to DELL/EMC Isilon servers fails... %patch098 -p1 -# 1518718 - RHEL7.4: NFS mount to DELL/EMC Isilon servers fails... +# 1489262 - nfs-utils: minorversion can't work %patch099 -p1 -# 1547681 - nfs-utils: minorversion can't work +# 987031 - nfs-utils - shebang with /usr/bin/env %patch100 -p1 +# 1475462 - nfsdcltrack -d should log to syslog without... +%patch101 -p1 +# 1450528 - RHEL7.4: service nfs-server start fails the first... +%patch102 -p1 +# 1496822 - mount.nfs calls mount() with nfsvers setting from... +%patch103 -p1 +# 1358333 - nfs-server: Possibility to change rpc_pipefs mount point +%patch104 -p1 +# 1461349 - nfsdcltrack should return error code instead of 0.... +%patch105 -p1 +# 1452461 - NFSv2 is supported at RHEL 7 nfs server end after making... +%patch106 -p1 +# 1508046 - nfsiostat errors on 'no device mounted on /sys/kernel/debug... +%patch107 -p1 +# 1547506 - Incorrect NFS version string reported for NFSv4.2 mounts +%patch108 -p1 %patch1000 -p1 %patch1001 -p1 @@ -632,6 +656,7 @@ fi %{_unitdir}/* %attr(755,root,root) /usr/lib/systemd/scripts/nfs-utils_env.sh %{_prefix}/lib/systemd/system-generators/nfs-server-generator +%{_prefix}/lib/systemd/system-generators/rpc-pipefs-generator %attr(4755,root,root) /sbin/mount.nfs /sbin/mount.nfs4 @@ -639,14 +664,29 @@ fi /sbin/umount.nfs4 %changelog -* Thu Feb 22 2018 Steve Dickson 1.3.0-0.48_4.2 -- mount: Fix problems with parsing minorversion= (bz 1547681) +* Thu Feb 22 2018 Steve Dickson 1.3.0-0.54 +- mount: move handling of "-t nfs4" into nfs_nfs_version() (bz 1547506) -* Thu Nov 30 2017 Steve Dickson 1.3.0-0.48_4.1 -- mount: handle EACCES during version negotiation (bz 1518718) +* Tue Jan 2 2018 Steve Dickson 1.3.0-0.53 +- nfs(5): updated mount information to say 4.1 (bz 1452461) -* Fri Oct 6 2017 Steve Dickson 1.3.0-0.48_4 +* Fri Nov 3 2017 Steve Dickson 1.3.0-0.52 +- nfs(5): update some version information (bz 1452461) +- nfsiostat: avoid parsing "no device mounted ..." line (bz 1508046) + +* Thu Oct 12 2017 Steve Dickson 1.3.0-0.51 +- systemd: add a generator for the rpc_pipefs mountpoint (bz 1358333) +- nfsdcltrack: return an non-zero value for invalid options (bz 1461349) + +* Thu Oct 5 2017 Steve Dickson 1.3.0-0.50 - rpc.nfsd: Do not fail when all address families are not support (bz 1450528) +- mount.nfs: merge in vers= and nfsvers= options (bz 1496822) + +* Tue Sep 19 2017 Steve Dickson 1.3.0-0.49 +- mount: handle EACCES during version negotiation (bz 1479573) +- mount: Fix problems with parsing minorversion= (bz 1489262) +- mountstats: Remove a shebang (bz 987031) +- nfsdcltrack: remove a warning (bz 1475462) * Mon Jun 19 2017 Steve Dickson 1.3.0-0.48 - exportfs: fix path comparison in unexportfs_parsed() (bz 1389046)