import nfs-utils-2.3.3-14.el8_0

This commit is contained in:
CentOS Sources 2019-08-02 11:31:48 -04:00 committed by Stepan Oksanichenko
commit 32d95d5a4f
23 changed files with 7218 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/nfs-utils-2.3.3.tar.xz

1
.nfs-utils.metadata Normal file
View File

@ -0,0 +1 @@
a60aa17b057734c63bf7ce1598898e83f2132644 SOURCES/nfs-utils-2.3.3.tar.xz

View File

@ -0,0 +1,7 @@
[service/nfs-server]
mechs = krb5
socket = /run/gssproxy.sock
cred_store = keytab:/etc/krb5.keytab
trusted = yes
kernel_nfsd = yes
euid = 0

9
SOURCES/id_resolver.conf Normal file
View File

@ -0,0 +1,9 @@
#
# nfsidmap(5) - The NFS idmapper upcall program
# Summary: Used by NFSv4 to map user/group ids into
# user/group names and names into in ids
# Options:
# -v Increases the verbosity of the output to syslog
# -t timeout Set the expiration timer, in seconds, on the key
#
create id_resolver * * /usr/sbin/nfsidmap %k %d

23
SOURCES/lockd.conf Normal file
View File

@ -0,0 +1,23 @@
#
# Set the NFS lock manager grace period. n is measured in seconds.
#options lockd nlm_grace_period=90
#
# Set the TCP port that the NFS lock manager should use.
# port must be a valid TCP port value (1-65535).
#options lockd nlm_tcpport
#
# Set the UDP port that the NFS lock manager should use.
# port must be a valid UDP port value (1-65535).
#options lockd nlm_udpport
#
# Set the maximum number of outstanding connections
#options lockd nlm_max_connections=1024
#
# Set the default time value for the NFS lock manager
# in seconds. Default is 10 secs (min 3 max 20)
#options lockd nlm_timeout=10
#
# Choose whether to record the caller_name or IP address
# this peer in the local rpc.statd's database.
#options lockd nsm_use_hostnames=0

View File

@ -0,0 +1,24 @@
[Unit]
Description=Preprocess NFS configuration convertion
DefaultDependencies=no
Before=nfs-server.service nfs-mountd.service nfs-idmapd.service
Before=nfs-blkmap.service rpc-statd.service rpc-gssd.service
Before=rpc-statd-notify.service
After=initrd-root-fs.target
ConditionPathExists=/etc/sysconfig/nfs
[Service]
Type=oneshot
ExecStart=/usr/libexec/nfs-utils/nfsconvert.sh
[Install]
RequiredBy=nfs-server.service
RequiredBy=nfs-mountd.service
RequiredBy=nfs-idmapd.service
RequiredBy=nfs-blkmap.service
RequiredBy=rpc-statd.service
RequiredBy=rpc-gssd.service
RequiredBy=rpc-statd-notify.service

View File

@ -0,0 +1,12 @@
diff -up nfs-utils-2.1.1/support/nfs/exports.c.orig nfs-utils-2.1.1/support/nfs/exports.c
--- nfs-utils-2.1.1/support/nfs/exports.c.orig 2017-01-12 10:21:39.000000000 -0500
+++ nfs-utils-2.1.1/support/nfs/exports.c 2017-04-26 12:46:24.186480312 -0400
@@ -507,7 +507,7 @@ void fix_pseudoflavor_flags(struct expor
static int
parseopts(char *cp, struct exportent *ep, int warn, int *had_subtree_opt_ptr)
{
- int had_subtree_opt = 0;
+ int had_subtree_opt = 1;
char *flname = efname?efname:"command line";
int flline = efp?efp->x_line:0;
unsigned int active = 0;

View File

@ -0,0 +1,58 @@
diff -up nfs-utils-2.1.1/utils/statd/sm-notify.man.orig nfs-utils-2.1.1/utils/statd/sm-notify.man
--- nfs-utils-2.1.1/utils/statd/sm-notify.man.orig 2017-04-26 12:45:14.205742654 -0400
+++ nfs-utils-2.1.1/utils/statd/sm-notify.man 2017-04-26 12:45:44.042630801 -0400
@@ -184,7 +184,7 @@ where NSM state information resides.
If this option is not specified,
.B sm-notify
uses
-.I /var/lib/nfs
+.I /var/lib/nfs/statd
by default.
.IP
After starting,
@@ -330,13 +330,13 @@ Currently, the
command supports sending notification only via datagram transport protocols.
.SH FILES
.TP 2.5i
-.I /var/lib/nfs/sm
+.I /var/lib/nfs/statd/sm
directory containing monitor list
.TP 2.5i
-.I /var/lib/nfs/sm.bak
+.I /var/lib/nfs/statd/sm.bak
directory containing notify list
.TP 2.5i
-.I /var/lib/nfs/state
+.I /var/lib/nfs/statd/state
NSM state number for this host
.TP 2.5i
.I /proc/sys/fs/nfs/nsm_local_state
diff -up nfs-utils-2.1.1/utils/statd/statd.man.orig nfs-utils-2.1.1/utils/statd/statd.man
--- nfs-utils-2.1.1/utils/statd/statd.man.orig 2017-01-12 10:21:39.000000000 -0500
+++ nfs-utils-2.1.1/utils/statd/statd.man 2017-04-26 12:45:44.043630798 -0400
@@ -253,7 +253,7 @@ where NSM state information resides.
If this option is not specified,
.B rpc.statd
uses
-.I /var/lib/nfs
+.I /var/lib/nfs/statd
by default.
.IP
After starting,
@@ -425,13 +425,13 @@ If set to a positive integer, has the sa
.IR \-\-no\-notify .
.SH FILES
.TP 2.5i
-.I /var/lib/nfs/sm
+.I /var/lib/nfs/statd/sm
directory containing monitor list
.TP 2.5i
-.I /var/lib/nfs/sm.bak
+.I /var/lib/nfs/statd/sm.bak
directory containing notify list
.TP 2.5i
-.I /var/lib/nfs/state
+.I /var/lib/nfs/statd/state
NSM state number for this host
.TP 2.5i
.I /var/run/run.statd.pid

View File

@ -0,0 +1,12 @@
diff -up nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c.orig nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c
--- nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c.orig 2017-01-12 10:21:39.000000000 -0500
+++ nfs-utils-2.1.1/utils/nfsidmap/nfsidmap.c 2017-04-26 12:47:56.715133443 -0400
@@ -432,7 +432,7 @@ int main(int argc, char **argv)
xlog_stderr(verbose);
if ((argc - optind) != 2) {
- xlog_warn("Bad arg count. Check /etc/request-key.conf");
+ xlog_err("Bad arg count. Check /etc/request-key.d/request-key.conf");
xlog_warn(usage, progname);
return EXIT_FAILURE;
}

View File

@ -0,0 +1,11 @@
diff -up nfs-utils-2.3.1/systemd/nfs-server.service.orig nfs-utils-2.3.1/systemd/nfs-server.service
--- nfs-utils-2.3.1/systemd/nfs-server.service.orig 2018-01-19 10:25:38.153513857 -0500
+++ nfs-utils-2.3.1/systemd/nfs-server.service 2018-01-19 10:30:52.977245126 -0500
@@ -26,6 +26,7 @@ Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
ExecStart=/usr/sbin/rpc.nfsd
+ExecStart=-/bin/sh -c 'if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi'
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f

View File

@ -0,0 +1,65 @@
diff -up nfs-utils-2.3.3/systemd/auth-rpcgss-module.service.orig nfs-utils-2.3.3/systemd/auth-rpcgss-module.service
--- nfs-utils-2.3.3/systemd/auth-rpcgss-module.service.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/systemd/auth-rpcgss-module.service 2018-10-17 10:42:17.682830880 -0400
@@ -1,5 +1,5 @@
-# We want to start gss-proxy on kernels that support it and rpc.svcgssd
-# on those that don't. Those services check for support by checking
+# We want to start gss-proxy on kernels that support it
+# Those services check for support by checking
# for existence of the path /proc/net/rpc/use-gss-proxy. Before they
# can perform that check, they need this module loaded. (Unless
# rpcsec_gss support is built directly into the kernel, in which case this
@@ -7,8 +7,8 @@
[Unit]
Description=Kernel Module supporting RPCSEC_GSS
DefaultDependencies=no
-Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
-Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
+Before=gssproxy.service rpc-gssd.service
+Wants=gssproxy.service rpc-gssd.service
ConditionPathExists=/etc/krb5.keytab
[Service]
diff -up nfs-utils-2.3.3/systemd/nfs-client.target.orig nfs-utils-2.3.3/systemd/nfs-client.target
--- nfs-utils-2.3.3/systemd/nfs-client.target.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/systemd/nfs-client.target 2018-10-17 10:42:17.682830880 -0400
@@ -9,7 +9,7 @@ Wants=rpc-statd-notify.service
# GSS services dependencies and ordering
Wants=auth-rpcgss-module.service
-After=rpc-gssd.service rpc-svcgssd.service gssproxy.service
+After=rpc-gssd.service gssproxy.service
[Install]
WantedBy=multi-user.target
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 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/systemd/nfs.conf.man 2018-10-17 10:42:17.682830880 -0400
@@ -226,15 +226,6 @@ See
for details.
.TP
-.B svcgssd
-Recognized values:
-.BR principal .
-
-See
-.BR rpc.svcgssd (8)
-for details.
-
-.TP
.B exportfs
Only
.B debug=
diff -up nfs-utils-2.3.3/systemd/nfs-server.service.orig nfs-utils-2.3.3/systemd/nfs-server.service
--- nfs-utils-2.3.3/systemd/nfs-server.service.orig 2018-10-17 10:41:24.347121069 -0400
+++ nfs-utils-2.3.3/systemd/nfs-server.service 2018-10-17 10:42:17.683830874 -0400
@@ -14,7 +14,7 @@ Before= rpc-statd-notify.service
# GSS services dependencies and ordering
Wants=auth-rpcgss-module.service
-After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
+After=rpc-gssd.service gssproxy.service
[Service]
Type=oneshot

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
commit 104f90f4ce964ddcfe50d4d24cc5e7ff96952299
Author: Steve Dickson <steved@redhat.com>
Date: Sat Oct 20 12:01:37 2018 -0400
gssd: Introduce use-gss-proxy boolean to nfs.conf
Allow the used of the gssprox-mech(8) through a the
boolean variable in the [gssd] section of nfs.conf
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/nfs.conf b/nfs.conf
index 0d0ec9b..5546109 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -11,6 +11,7 @@
#[gssd]
# use-memcache=0
# use-machine-creds=1
+# use-gss-proxy=0
# avoid-dns=1
# limit-to-legacy-enctypes=0
# context-timeout=0
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 189b052..699db3f 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -213,6 +213,7 @@ for details.
Recognized values:
.BR use-memcache ,
.BR use-machine-creds ,
+.BR use-gss-proxy ,
.BR avoid-dns ,
.BR limit-to-legacy-enctypes ,
.BR context-timeout ,
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 00df2fc..2e92f28 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -89,6 +89,7 @@ char *preferred_realm = NULL;
char *ccachedir = NULL;
/* Avoid DNS reverse lookups on server names */
static bool avoid_dns = true;
+static bool use_gssproxy = false;
int thread_started = false;
pthread_mutex_t pmutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t pcond = PTHREAD_COND_INITIALIZER;
@@ -872,6 +873,7 @@ read_gss_conf(void)
if (s)
preferred_realm = s;
+ use_gssproxy = conf_get_bool("gssd", "use-gss-proxy", use_gssproxy);
}
int
@@ -957,6 +959,14 @@ main(int argc, char *argv[])
exit(1);
}
+ if (use_gssproxy) {
+ if (setenv("GSS_USE_PROXY", "yes", 1) < 0) {
+ printerr(0, "gssd: Unable to set $GSS_USE_PROXY: %s\n",
+ strerror(errno));
+ exit(EXIT_FAILURE);
+ }
+ }
+
if (ccachedir) {
char *ccachedir_copy;
char *ptr;

View File

@ -0,0 +1,162 @@
diff --git a/aclocal/libxml2.m4 b/aclocal/libxml2.m4
index 5c399b2..8231553 100644
--- a/aclocal/libxml2.m4
+++ b/aclocal/libxml2.m4
@@ -1,15 +1,17 @@
dnl Checks for libxml2.so
AC_DEFUN([AC_LIBXML2], [
- if test "$enable_junction" = yes; then
+ PKG_PROG_PKG_CONFIG([0.9.0])
+ AS_IF(
+ [test "$enable_junction" = "yes"],
+ [PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.4],
+ [LIBXML2="${XML2_LIBS}"
+ AM_CPPFLAGS="${AM_CPPFLAGS} ${XML2_CFLAGS}"
+ AC_DEFINE([HAVE_LIBXML2], [1],
+ [Define to 1 if you have and wish to use libxml2.])],
+ [AC_MSG_ERROR([libxml2 not found.])])])
- dnl look for the library; do not add to LIBS if found
- AC_CHECK_LIB([xml2], [xmlParseFile], [LIBXML2=-lxml2],
- [AC_MSG_ERROR([libxml2 not found.])])
- AC_SUBST(LIBXML2)
-
- dnl XXX should also check for presence of xml headers
-
- fi
+ AC_SUBST([AM_CPPFLAGS])
+ AC_SUBST(LIBXML2)
])dnl
diff --git a/configure.ac b/configure.ac
index cf1c4b9..b458891 100644
--- a/configure.ac
+++ b/configure.ac
@@ -165,7 +165,7 @@ AC_ARG_ENABLE(uuid,
choose_blkid=default)
AC_ARG_ENABLE(mount,
[AC_HELP_STRING([--disable-mount],
- [Don't build mount.nfs and do use the util-linux mount(8) functionality. @<:@default=no@:>@])],
+ [Do not build mount.nfs and do use the util-linux mount(8) functionality. @<:@default=no@:>@])],
enable_mount=$enableval,
enable_mount=yes)
AM_CONDITIONAL(CONFIG_MOUNT, [test "$enable_mount" = "yes"])
@@ -185,7 +185,13 @@ AC_ARG_ENABLE(junction,
[enable support for NFS junctions @<:@default=no@:>@])],
enable_junction=$enableval,
enable_junction=no)
-AM_CONDITIONAL(CONFIG_JUNCTION, [test "$enable_junction" = "yes" ])
+ if test "$enable_junction" = yes; then
+ AC_DEFINE(HAVE_JUNCTION_SUPPORT, 1,
+ [Define this if you want junction support compiled in])
+ else
+ enable_junction=
+ fi
+ AM_CONDITIONAL(CONFIG_JUNCTION, [test "$enable_junction" = "yes" ])
AC_ARG_ENABLE(tirpc,
[AC_HELP_STRING([--disable-tirpc],
diff --git a/support/junction/Makefile.am b/support/junction/Makefile.am
index 97e7426..be6958b 100644
--- a/support/junction/Makefile.am
+++ b/support/junction/Makefile.am
@@ -30,5 +30,3 @@ libjunction_la_SOURCES = display.c export-cache.c junction.c \
locations.c nfs.c path.c xml.c
MAINTAINERCLEANFILES = Makefile.in
-
-AM_CPPFLAGS = -I. -I../include -I/usr/include/libxml2
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 6f42512..7e8d403 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -976,8 +976,9 @@ lookup_export(char *dom, char *path, struct addrinfo *ai)
return found;
}
-#ifdef CONFIG_JUNCTION
+#ifdef HAVE_JUNCTION_SUPPORT
+#include <libxml/parser.h>
#include "junction.h"
struct nfs_fsloc_set {
@@ -1084,8 +1085,7 @@ static bool locations_to_fslocdata(struct nfs_fsloc_set *locations,
*ttl = 0;
for (;;) {
- enum jp_status status;
- int len;
+ int len, status;
status = get_next_location(locations, &server,
&rootpath, ttl);
@@ -1219,7 +1219,7 @@ nfs_get_basic_junction(const char *junct_path, struct nfs_fsloc_set **locset)
return EINVAL;
}
- locset->ns_current = locset->ns_list;
+ new->ns_current = new->ns_list;
new->ns_ttl = 300;
*locset = new;
return 0;
@@ -1242,7 +1242,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
status = nfs_get_basic_junction(pathname, &locations);
switch (status) {
xlog(L_WARNING, "Dangling junction %s: %s",
- pathname, strerro(status));
+ pathname, strerror(status));
goto out;
}
@@ -1252,8 +1252,8 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
exp = locations_to_export(locations, pathname, parent);
- nfs_free_locations(locset->ns_list);
- free(locset);
+ nfs_free_locations(locations->ns_list);
+ free(locations);
out:
xmlCleanupParser();
@@ -1273,7 +1273,7 @@ static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path
free(eep);
}
-#else /* !CONFIG_JUNCTION */
+#else /* !HAVE_JUNCTION_SUPPORT */
static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path,
struct addrinfo *UNUSED(ai))
@@ -1281,7 +1281,7 @@ static void lookup_nonexport(int f, char *buf, int buflen, char *dom, char *path
dump_to_cache(f, buf, buflen, dom, path, NULL, 0);
}
-#endif /* !CONFIG_JUNCTION */
+#endif /* !HAVE_JUNCTION_SUPPORT */
static void nfsd_export(int f)
{
diff --git a/utils/nfsref/Makefile.am b/utils/nfsref/Makefile.am
index 2b2bb53..2409dd0 100644
--- a/utils/nfsref/Makefile.am
+++ b/utils/nfsref/Makefile.am
@@ -27,13 +27,11 @@ noinst_HEADERS = nfsref.h
sbin_PROGRAMS = nfsref
nfsref_SOURCES = add.c lookup.c nfsref.c remove.c
-LDADD = $(LIBXML2) $(LIBCAP) \
- ../../support/nfs/libnfs.la \
- ../../support/junction/libjunction.la
+LDADD = ../../support/nfs/libnfs.la \
+ ../../support/junction/libjunction.la \
+ $(LIBXML2) $(LIBCAP)
man8_MANS = nfsref.man
MAINTAINERCLEANFILES = Makefile.in
-AM_CPPFLAGS = -I. -I../../support/include
-##AM_LDFLAGS = -Wl,--as-needed

View File

@ -0,0 +1,89 @@
diff -up nfs-utils-2.3.3/utils/mountd/mountd.man.orig nfs-utils-2.3.3/utils/mountd/mountd.man
--- nfs-utils-2.3.3/utils/mountd/mountd.man.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/mountd/mountd.man 2018-10-26 09:53:10.005127368 -0400
@@ -232,36 +232,7 @@ section include
which each have same same meaning as given by
.BR rpc.nfsd (8).
-.SH TCP_WRAPPERS SUPPORT
-You can protect your
-.B rpc.mountd
-listeners using the
-.B tcp_wrapper
-library or
-.BR iptables (8).
-.PP
-Note that the
-.B tcp_wrapper
-library supports only IPv4 networking.
-.PP
-Add the hostnames of NFS peers that are allowed to access
-.B rpc.mountd
-to
-.IR /etc/hosts.allow .
-Use the daemon name
-.B mountd
-even if the
-.B rpc.mountd
-binary has a different name.
-.PP
-Hostnames used in either access file will be ignored when
-they can not be resolved into IP addresses.
-For further information see the
-.BR tcpd (8)
-and
-.BR hosts_access (5)
-man pages.
-.SS IPv6 and TI-RPC support
+.SH IPv6 and TI-RPC support
TI-RPC is a pre-requisite for supporting NFS on IPv6.
If TI-RPC support is built into
.BR rpc.mountd ,
@@ -288,7 +259,6 @@ table of clients accessing server's expo
.BR nfs (5),
.BR nfs.conf (5),
.BR tcpd (8),
-.BR hosts_access (5),
.BR iptables (8),
.BR netconfig (5)
.sp
diff -up nfs-utils-2.3.3/utils/statd/statd.man.orig nfs-utils-2.3.3/utils/statd/statd.man
--- nfs-utils-2.3.3/utils/statd/statd.man.orig 2018-10-26 09:52:27.609358805 -0400
+++ nfs-utils-2.3.3/utils/statd/statd.man 2018-10-26 09:53:37.345978117 -0400
@@ -319,28 +319,6 @@ chooses, simply use
.BR chown (1)
to set the owner of
the state directory.
-.PP
-You can also protect your
-.B rpc.statd
-listeners using the
-.B tcp_wrapper
-library or
-.BR iptables (8).
-To use the
-.B tcp_wrapper
-library, add the hostnames of peers that should be allowed access to
-.IR /etc/hosts.allow .
-Use the daemon name
-.B statd
-even if the
-.B rpc.statd
-binary has a different filename.
-.P
-For further information see the
-.BR tcpd (8)
-and
-.BR hosts_access (5)
-man pages.
.SH ADDITIONAL NOTES
Lock recovery after a reboot is critical to maintaining data integrity
and preventing unnecessary application hangs.
@@ -445,7 +423,6 @@ network transport capability database
.BR rpc.nfsd (8),
.BR rpcbind (8),
.BR tcpd (8),
-.BR hosts_access (5),
.BR iptables (8),
.BR netconfig (5)
.sp

View File

@ -0,0 +1,47 @@
diff -up nfs-utils-2.3.3/utils/mount/Makefile.am.orig nfs-utils-2.3.3/utils/mount/Makefile.am
--- nfs-utils-2.3.3/utils/mount/Makefile.am.orig 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/mount/Makefile.am 2018-10-25 10:27:33.881804941 -0400
@@ -27,6 +27,7 @@ endif
mount_nfs_LDADD = ../../support/nfs/libnfs.la \
../../support/export/libexport.a \
+ ../../support/misc/libmisc.a \
$(LIBTIRPC)
mount_nfs_SOURCES = $(mount_common)
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 2018-09-06 14:09:08.000000000 -0400
+++ nfs-utils-2.3.3/utils/mount/stropts.c 2018-10-25 10:27:59.733825016 -0400
@@ -48,6 +48,7 @@
#include "version.h"
#include "parse_dev.h"
#include "conffile.h"
+#include "misc.h"
#ifndef NFS_PROGRAM
#define NFS_PROGRAM (100003)
@@ -1078,14 +1079,18 @@ static int nfsmount_fg(struct nfsmount_i
if (nfs_try_mount(mi))
return EX_SUCCESS;
- if (errno == EBUSY)
- /* The only cause of EBUSY is if exactly the desired
- * filesystem is already mounted. That can arguably
- * be seen as success. "mount -a" tries to optimise
- * out this case but sometimes fails. Help it out
- * by pretending everything is rosy
+#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers"
+ if (errno == EBUSY && is_mountpoint(mi->node)) {
+#pragma GCC diagnostic warning "-Wdiscarded-qualifiers"
+ /*
+ * EBUSY can happen when mounting a filesystem that
+ * is already mounted or when the context= are
+ * different when using the -o sharecache
+ *
+ * Only error out in the latter case.
*/
return EX_SUCCESS;
+ }
if (nfs_is_permanent_error(errno))
break;

View File

@ -0,0 +1,82 @@
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 2018-10-22 13:34:58.927700353 -0400
+++ nfs-utils-2.3.3/nfs.conf 2018-10-22 14:14:36.864110090 -0400
@@ -2,16 +2,16 @@
# This is a general configuration for the
# NFS daemons and tools
#
-#[general]
+[general]
# pipefs-directory=/var/lib/nfs/rpc_pipefs
#
-#[exportfs]
+[exportfs]
# debug=0
#
-#[gssd]
+[gssd]
# use-memcache=0
# use-machine-creds=1
-# use-gss-proxy=0
+use-gss-proxy=1
# avoid-dns=1
# limit-to-legacy-enctypes=0
# context-timeout=0
@@ -20,11 +20,11 @@
# cred-cache-directory=
# preferred-realm=
#
-#[lockd]
+[lockd]
# port=0
# udp-port=0
#
-#[mountd]
+[mountd]
# debug=0
# manage_gids=n
# descriptors=0
@@ -34,18 +34,17 @@
# state-directory-path=/var/lib/nfs
# ha-callout=
#
-#[nfsdcltrack]
+[nfsdcltrack]
# debug=0
# storagedir=/var/lib/nfs/nfsdcltrack
#
-#[nfsd]
+[nfsd]
# debug=0
# threads=8
# host=
# port=0
# grace-time=90
# lease-time=90
-# udp=n
# tcp=y
# vers2=n
# vers3=y
@@ -55,7 +54,7 @@
# vers4.2=y
# rdma=n
#
-#[statd]
+[statd]
# debug=0
# port=0
# outgoing-port=0
@@ -63,12 +62,10 @@
# state-directory-path=/var/lib/nfs/statd
# ha-callout=
#
-#[sm-notify]
+[sm-notify]
# debug=0
# retry-time=900
# outgoing-port=
# outgoing-addr=
# lift-grace=y
#
-#[svcgssd]
-# principal=

View File

@ -0,0 +1,104 @@
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 2c14e5f..00df2fc 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -888,6 +888,9 @@ 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);
+
while ((opt = getopt(argc, argv, "DfvrlmnMp:k:d:t:T:R:")) != -1) {
switch (opt) {
case 'f':
diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
index 8e918cc..ec49b61 100644
--- a/utils/gssd/svcgssd.c
+++ b/utils/gssd/svcgssd.c
@@ -113,6 +113,10 @@ main(int argc, char *argv[])
else
principal = s;
+ verbosity = conf_get_num("svcgssd", "Verbosity", verbosity);
+ rpc_verbosity = conf_get_num("svcgssd", "RPC-Verbosity", rpc_verbosity);
+ idmap_verbosity = conf_get_num("svcgssd", "IDMAP-Verbosity", idmap_verbosity);
+
while ((opt = getopt(argc, argv, "fivrnp:")) != -1) {
switch (opt) {
case 'f':
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index 4811e0f..d14eef7 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -261,6 +261,10 @@ main(int argc, char **argv)
strlcpy(pipefsdir, xpipefsdir, sizeof(pipefsdir));
CONF_SAVE(nobodyuser, conf_get_str("Mapping", "Nobody-User"));
CONF_SAVE(nobodygroup, conf_get_str("Mapping", "Nobody-Group"));
+ if (conf_get_bool("General", "server-only", false))
+ clientstart = 0;
+ if (conf_get_bool("General", "client-only", false))
+ serverstart = 0;
}
} else {
conf_path = NFS_CONFFILE;
@@ -276,6 +280,10 @@ main(int argc, char **argv)
"cache-expiration", DEFAULT_IDMAP_CACHE_EXPIRY);
CONF_SAVE(nobodyuser, conf_get_str("Mapping", "Nobody-User"));
CONF_SAVE(nobodygroup, conf_get_str("Mapping", "Nobody-Group"));
+ if (conf_get_bool("General", "server-only", false))
+ clientstart = 0;
+ if (conf_get_bool("General", "client-only", false))
+ serverstart = 0;
}
while ((opt = getopt(argc, argv, GETOPTSTR)) != -1)
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 6b57e2b..b256bd9 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -83,6 +83,9 @@ main(int argc, char **argv)
conf_init_file(NFS_CONFFILE);
xlog_from_conffile("nfsd");
+
+ nfssvc_get_minormask(&minormask);
+
count = conf_get_num("nfsd", "threads", count);
grace = conf_get_num("nfsd", "grace-time", grace);
lease = conf_get_num("nfsd", "lease-time", lease);
@@ -101,13 +104,19 @@ main(int argc, char **argv)
for (i = 2; i <= 4; i++) {
char tag[20];
sprintf(tag, "vers%d", i);
- if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i)))
+ if (conf_get_bool("nfsd", tag, NFSCTL_VERISSET(versbits, i))) {
NFSCTL_VERSET(versbits, i);
- else
+ if (i == 4)
+ minorvers = minorversset = minormask;
+ } else {
NFSCTL_VERUNSET(versbits, i);
+ if (i == 4) {
+ minorvers = 0;
+ minorversset = minormask;
+ }
+ }
}
- nfssvc_get_minormask(&minormask);
/* We assume the kernel will default all minor versions to 'on',
* and allow the config file to disable some.
*/
diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c
index 7a48473..29dad38 100644
--- a/utils/statd/sm-notify.c
+++ b/utils/statd/sm-notify.c
@@ -503,6 +503,7 @@ main(int argc, char **argv)
s = conf_get_str("statd", "state-directory-path");
if (s && !nsm_setup_pathnames(argv[0], s))
exit(1);
+ opt_update_state = conf_get_bool("sm-notify", "update-state", opt_update_state);
while ((c = getopt(argc, argv, "dm:np:v:P:f")) != -1) {
switch (c) {

View File

@ -0,0 +1,188 @@
commit 80b17639d78e152306d8d1753d719654ebb40e01
Author: Steve Dickson <steved@redhat.com>
Date: Fri Oct 19 10:26:10 2018 -0400
Remove osd_login
This ancient script has not been used
in years, if used at all.
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/configure.ac b/configure.ac
index e82ff14..cf1c4b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -238,13 +238,6 @@ AC_ARG_ENABLE(nfsdcltrack,
enable_nfsdcltrack=$enableval,
enable_nfsdcltrack="yes")
-AC_ARG_ENABLE(osdlogin,
- [AC_HELP_STRING([--enable-osdlogin],
- [enable osd_login scripts @<:@default=no@:>@])],
- enable_osdlogin=$enableval,
- enable_osdlogin="no")
- AM_CONDITIONAL(CONFIG_OSD_LOGIN, [test "$enable_osdlogin" = "yes" ])
-
dnl Check for TI-RPC library and headers
AC_LIBTIRPC
@@ -631,7 +624,6 @@ AC_CONFIG_FILES([
utils/nfsidmap/Makefile
utils/showmount/Makefile
utils/statd/Makefile
- utils/osd_login/Makefile
systemd/Makefile
tests/Makefile
tests/nsm_client/Makefile])
diff --git a/utils/Makefile.am b/utils/Makefile.am
index d361aea..0a5b062 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -34,7 +34,6 @@ SUBDIRS = \
nfsstat \
showmount \
statd \
- osd_login \
$(OPTDIRS)
MAINTAINERCLEANFILES = Makefile.in
diff --git a/utils/osd_login/Makefile.am b/utils/osd_login/Makefile.am
deleted file mode 100644
index ded1fd3..0000000
--- a/utils/osd_login/Makefile.am
+++ /dev/null
@@ -1,9 +0,0 @@
-## Process this file with automake to produce Makefile.in
-
-# These binaries go in /sbin (not /usr/sbin), and that cannot be
-# overridden at config time.
-sbindir = /sbin
-
-dist_sbin_SCRIPTS = osd_login
-
-MAINTAINERCLEANFILES = Makefile.in
diff --git a/utils/osd_login/osd_login b/utils/osd_login/osd_login
deleted file mode 100644
index 08cd2d2..0000000
--- a/utils/osd_login/osd_login
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/bin/bash
-#
-# osd_login : This script is part of the autologin feature
-# mandated by the pnfs-objects standard.
-# It is called from objlayoutdriver.ko in the kernel.
-
-# Copyright (C) 2012, Sachin Bhamare <sbhamare@panasas.com>
-# Copyright (C) 2012, Boaz Harrosh <bharrosh@panasas.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# 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
-
-umask 022
-
-PATH="/sbin:/usr/sbin:/bin:/usr/bin"
-
-iscsiadm=/sbin/iscsiadm
-
-PARENT_PID=$BASHPID
-WATCHDOG_TIMEOUT=15
-
-protocol=""
-portal=""
-uri=""
-osdname=""
-systemid=""
-
-usage()
-{
- echo "Usage: $0 -u <URI> -o <OSDNAME> -s <SYSTEMID>"
- echo "Options:"
- echo "-u target uri e.g. iscsi://<ip>:<port>"
- echo "-o osdname of the target OSD"
- echo "-s systemid of the target OSD"
-}
-
-parse_cmdline()
-{
- argc=$#
- if [ $# -lt 3 ]; then
- usage
- exit 1
- fi
-
- # parse the input arguments
- while getopts "u:o:s:" options; do
- case $options in
- u ) uri=$OPTARG;;
- o ) osdname=$OPTARG;;
- s ) systemid=$OPTARG;;
- \? ) usage
- exit 1;;
- * ) usage
- exit 1;;
- esac
- done
-
- echo "-u : $uri"
- echo "-o : $osdname"
- echo "-s : $systemid"
-
- protocol=`echo $uri | awk -F ':' '{print $1}'`
- portal=`echo $uri | awk -F '//' '{print $2}'`
-}
-
-watchdog()
-{
- timeout=$1
- portal=$2
-
- sleep $timeout
- if kill -9 $PARENT_PID; then
- echo "watchdog : Timed out (>$timeout seconds) while login into $portal" | logger -t "osd_login"
- fi
- echo "watchdog: exiting .."
- exit 2
-}
-
-login_iscsi_osd()
-{
- echo "login into: $1"
- if ! $iscsiadm -m discovery -o nonpersistent -t sendtargets -p $1 --login; then
- echo "$iscsiadm -m discovery -t sendtargets -p $1 --login returned error $? !"
- sleep 1;
- fi
-}
-
-echo "============= osd_login ========="
-echo "progname : $0"
-parse_cmdline "$@"
-echo "protocol: $protocol"
-echo "portal: $portal"
-
-watchdog $WATCHDOG_TIMEOUT $portal &
-watchdog_pid=$!
-
-case $protocol in
-iscsi)
- login_iscsi_osd $portal |& logger -t "osd_login"
- ;;
-*)
- echo "Error: protocol $protocol not supported !" | logger -t "osd_login"
- ;;
-esac
-
-kill -9 $watchdog_pid
-exit 0

View File

@ -0,0 +1,105 @@
commit 5394f939b591e65fec37a6bee826c13620d3f39b
Author: Justin Mitchell <jumitche@redhat.com>
Date: Mon Mar 4 11:53:09 2019 -0500
Add nfs.conf equivalent for the statd --no-notify cmdline option
Also cleaned up how nfs.conf is read.
Signed-off-by: Justin Mitchell <jumitche@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
diff --git a/nfs.conf b/nfs.conf
index f1ebfdb..d332375 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -62,6 +62,7 @@
# name=
# state-directory-path=/var/lib/nfs/statd
# ha-callout=
+# no-notify=0
#
[sm-notify]
# debug=0
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 2cc6cf3..1467380 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -238,6 +238,39 @@ static void set_nlm_port(char *type, int port)
fprintf(stderr, "%s: failed to open %s: %s\n",
name_p, pathbuf, strerror(errno));
}
+int port = 0, out_port = 0;
+int nlm_udp = 0, nlm_tcp = 0;
+
+inline static void
+read_nfsconf(char **argv)
+{
+ char *s;
+
+ conf_init_file(NFS_CONFFILE);
+ xlog_from_conffile("statd");
+
+ out_port = conf_get_num("statd", "outgoing-port", out_port);
+ port = conf_get_num("statd", "port", port);
+
+ MY_NAME = conf_get_str("statd", "name");
+ if (MY_NAME)
+ run_mode |= STATIC_HOSTNAME;
+
+ s = conf_get_str("statd", "state-directory-path");
+ if (s && !nsm_setup_pathnames(argv[0], s))
+ exit(1);
+
+ s = conf_get_str("statd", "ha-callout");
+ if (s)
+ ha_callout_prog = s;
+
+ nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
+ /* udp defaults to the same as tcp ! */
+ nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
+
+ if (conf_get_bool("statd", "no-notify", false))
+ run_mode |= MODE_NO_NOTIFY;
+}
/*
* Entry routine/main loop.
@@ -245,11 +278,8 @@ static void set_nlm_port(char *type, int port)
int main (int argc, char **argv)
{
extern char *optarg;
- char *s;
int pid;
int arg;
- int port = 0, out_port = 0;
- int nlm_udp = 0, nlm_tcp = 0;
struct rlimit rlim;
int notify_sockfd;
char *env;
@@ -275,23 +305,8 @@ int main (int argc, char **argv)
/* Set hostname */
MY_NAME = NULL;
- conf_init_file(NFS_CONFFILE);
- xlog_from_conffile("statd");
- out_port = conf_get_num("statd", "outgoing-port", out_port);
- port = conf_get_num("statd", "port", port);
- MY_NAME = conf_get_str("statd", "name");
- if (MY_NAME)
- run_mode |= STATIC_HOSTNAME;
- s = conf_get_str("statd", "state-directory-path");
- if (s && !nsm_setup_pathnames(argv[0], s))
- exit(1);
- s = conf_get_str("statd", "ha-callout");
- if (s)
- ha_callout_prog = s;
-
- nlm_tcp = conf_get_num("lockd", "port", nlm_tcp);
- /* udp defaults to the same as tcp ! */
- nlm_udp = conf_get_num("lockd", "udp-port", nlm_tcp);
+ /* Read nfs.conf */
+ read_nfsconf(argv);
/* Process command line switches */
while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:LT:U:", longopts, NULL)) != EOF) {

312
SOURCES/nfsconvert.py Normal file
View File

@ -0,0 +1,312 @@
#!/usr/bin/env python3
"""
Read in the deprecated /etc/sysconfig/nfs file and
set the corresponding values in nfs.conf
"""
from __future__ import print_function
import os
import sys
import getopt
import subprocess
import configparser
CONF_NFS = '/etc/nfs.conf'
CONF_IDMAP = '/etc/idmapd.conf'
SYSCONF_NFS = '/etc/sysconfig/nfs'
SYSCONF_BACKUP = ".rpmsave"
CONF_TOOL = '/usr/sbin/nfsconf'
# options for nfsd found in RPCNFSDARGS
OPTS_NFSD = 'dH:p:rR:N:V:stTuUG:L:'
LONG_NFSD = ['debug', 'host=', 'port=', 'rdma=', 'nfs-version=', 'no-nfs-version=',
'tcp', 'no-tcp', 'udp', 'no-udp', 'grace-time=', 'lease-time=']
CONV_NFSD = {'-d': (CONF_NFS, 'nfsd', 'debug', 'all'),
'-H': (CONF_NFS, 'nfsd', 'host', ','),
'-p': (CONF_NFS, 'nfsd', 'port', '$1'),
'-r': (CONF_NFS, 'nfsd', 'rdma', 'nfsrdma'),
'-R': (CONF_NFS, 'nfsd', 'rdma', '$1'),
'-N': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'-V': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'-t': (CONF_NFS, 'nfsd', 'tcp', '1'),
'-T': (CONF_NFS, 'nfsd', 'tcp', '0'),
'-u': (CONF_NFS, 'nfsd', 'udp', '1'),
'-U': (CONF_NFS, 'nfsd', 'udp', '0'),
'-G': (CONF_NFS, 'nfsd', 'grace-time', '$1'),
'-L': (CONF_NFS, 'nfsd', 'lease-time', '$1'),
'$1': (CONF_NFS, 'nfsd', 'threads', '$1'),
'--debug': (CONF_NFS, 'nfsd', 'debug', 'all'),
'--host': (CONF_NFS, 'nfsd', 'host', ','),
'--port': (CONF_NFS, 'nfsd', 'port', '$1'),
'--rdma': (CONF_NFS, 'nfsd', 'rdma', '$1'),
'--no-nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'--nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'--tcp': (CONF_NFS, 'nfsd', 'tcp', '1'),
'--no-tcp': (CONF_NFS, 'nfsd', 'tcp', '0'),
'--udp': (CONF_NFS, 'nfsd', 'udp', '1'),
'--no-udp': (CONF_NFS, 'nfsd', 'udp', '0'),
'--grace-time': (CONF_NFS, 'nfsd', 'grace-time', '$1'),
'--lease-time': (CONF_NFS, 'nfsd', 'lease-time', '$1'),
}
# options for mountd found in RPCMOUNTDOPTS
OPTS_MOUNTD = 'go:d:H:p:N:nrs:t:V:'
LONG_MOUNTD = ['descriptors=', 'debug=', 'nfs-version=', 'no-nfs-version=',
'port=', 'no-tcp', 'ha-callout=', 'state-directory-path=',
'num-threads=', 'reverse-lookup', 'manage-gids', 'no-udp']
CONV_MOUNTD = {'-g': (CONF_NFS, 'mountd', 'manage-gids', '1'),
'-o': (CONF_NFS, 'mountd', 'descriptors', '$1'),
'-d': (CONF_NFS, 'mountd', 'debug', '$1'),
'-H': (CONF_NFS, 'mountd', 'ha-callout', '$1'),
'-p': (CONF_NFS, 'mountd', 'port', '$1'),
'-N': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'-V': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'-n': (CONF_NFS, 'nfsd', 'tcp', '0'),
'-s': (CONF_NFS, 'mountd', 'stat-directory-path', '$1'),
'-t': (CONF_NFS, 'mountd', 'threads', '$1'),
'-r': (CONF_NFS, 'mountd', 'reverse-lookup', '1'),
'-u': (CONF_NFS, 'nfsd', 'udp', '0'),
'--manage-gids': (CONF_NFS, 'mountd', 'manage-gids', '1'),
'--descriptors': (CONF_NFS, 'mountd', 'descriptors', '$1'),
'--debug': (CONF_NFS, 'mountd', 'debug', '$1'),
'--ha-callout': (CONF_NFS, 'mountd', 'ha-callout', '$1'),
'--port': (CONF_NFS, 'mountd', 'port', '$1'),
'--nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'y'),
'--no-nfs-version': (CONF_NFS, 'nfsd', 'vers$1', 'n'),
'--no-tcp': (CONF_NFS, 'nfsd', 'tcp', '0'),
'--state-directory-path': (CONF_NFS, 'mountd', 'state-directory-path', '$1'),
'--num-threads': (CONF_NFS, 'mountd', 'threads', '$1'),
'--reverse-lookup': (CONF_NFS, 'mountd', 'reverse-lookup', '1'),
'--no-udp': (CONF_NFS, 'nfsd', 'udp', '0'),
}
# options for statd found in STATDARG
OPTS_STATD = 'o:p:T:U:n:P:H:L'
LONG_STATD = ['outgoing-port=', 'port=', 'name=', 'state-directory-path=',
'ha-callout=', 'nlm-port=', 'nlm-udp-port=', 'no-notify']
CONV_STATD = {'-o': (CONF_NFS, 'statd', 'outgoing-port', '$1'),
'-p': (CONF_NFS, 'statd', 'port', '$1'),
'-T': (CONF_NFS, 'lockd', 'port', '$1'),
'-U': (CONF_NFS, 'lockd', 'udp-port', '$1'),
'-n': (CONF_NFS, 'statd', 'name', '$1'),
'-P': (CONF_NFS, 'statd', 'state-directory-path', '$1'),
'-H': (CONF_NFS, 'statd', 'ha-callout', '$1'),
'-L': (CONF_NFS, 'statd', 'no-notify', '1'),
'--outgoing-port': (CONF_NFS, 'statd', 'outgoing-port', '$1'),
'--port': (CONF_NFS, 'statd', 'port', '$1'),
'--name': (CONF_NFS, 'statd', 'name', '$1'),
'--state-directory-path': (CONF_NFS, 'statd', 'state-directory-path', '$1'),
'--ha-callout': (CONF_NFS, 'statd', 'ha-callout', '$1'),
'--nlm-port': (CONF_NFS, 'lockd', 'port', '$1'),
'--nlm-udp-port': (CONF_NFS, 'lockd', 'udp-port', '$1'),
'--no-notify': (CONF_NFS, 'statd', 'no-notify', '1'),
}
# options for sm-notify found in SMNOTIFYARGS
OPTS_SMNOTIFY = 'dm:np:v:P:'
CONV_SMNOTIFY = {'-d': (CONF_NFS, 'sm-notify', 'debug', 'all'),
'-m': (CONF_NFS, 'sm-notify', 'retry-time', '$1'),
'-n': (CONF_NFS, 'sm-notify', 'update-state', '1'),
'-p': (CONF_NFS, 'sm-notify', 'outgoing-port', '$1'),
'-v': (CONF_NFS, 'sm-notify', 'outgoing-addr', '$1'),
'-P': (CONF_NFS, 'statd', 'state-directory-path', '$1'),
}
# options for idmapd found in RPCIDMAPDARGS
OPTS_IDMAPD = 'vp:CS'
CONV_IDMAPD = {'-v': (CONF_IDMAP, 'general', 'verbosity', '+'),
'-p': (CONF_NFS, 'general', 'pipefs-directory', '$1'),
'-C': (CONF_IDMAP, 'general', 'client-only', '1'),
'-S': (CONF_IDMAP, 'general', 'server-only', '1'),
}
# options for gssd found in RPCGSSDARGS
OPTS_GSSD = 'Mnvrp:k:d:t:T:R:lD'
CONV_GSSD = {'-M': (CONF_NFS, 'gssd', 'use-memcache', '1'),
'-n': (CONF_NFS, 'gssd', 'root_uses_machine_creds', '0'),
'-v': (CONF_NFS, 'gssd', 'verbosity', '+'),
'-r': (CONF_NFS, 'gssd', 'rpc-verbosity', '+'),
'-p': (CONF_NFS, 'general', 'pipefs-directory', '$1'),
'-k': (CONF_NFS, 'gssd', 'keytab-file', '$1'),
'-d': (CONF_NFS, 'gssd', 'cred-cache-directory', '$1'),
'-t': (CONF_NFS, 'gssd', 'context-timeout', '$1'),
'-T': (CONF_NFS, 'gssd', 'rpc-timeout', '$1'),
'-R': (CONF_NFS, 'gssd', 'preferred-realm', '$1'),
'-l': (CONF_NFS, 'gssd', 'limit-to-legacy-enctypes', '0'),
'-D': (CONF_NFS, 'gssd', 'avoid-dns', '0'),
}
# options for blkmapd found in BLKMAPDARGS
OPTS_BLKMAPD = ''
CONV_BLKMAPD = {}
# meta list of all the getopt lists
GETOPT_MAPS = [('RPCNFSDARGS', OPTS_NFSD, LONG_NFSD, CONV_NFSD),
('RPCMOUNTDOPTS', OPTS_MOUNTD, LONG_MOUNTD, CONV_MOUNTD),
('STATDARG', OPTS_STATD, LONG_STATD, CONV_STATD),
('STATDARGS', OPTS_STATD, LONG_STATD, CONV_STATD),
('SMNOTIFYARGS', OPTS_SMNOTIFY, [], CONV_SMNOTIFY),
('RPCIDMAPDARGS', OPTS_IDMAPD, [], CONV_IDMAPD),
('RPCGSSDARGS', OPTS_GSSD, [], CONV_GSSD),
('BLKMAPDARGS', OPTS_BLKMAPD, [], CONV_BLKMAPD),
]
# map for all of the single option values
VALUE_MAPS = {'LOCKD_TCPPORT': (CONF_NFS, 'lockd', 'port', '$1'),
'LOCKD_UDPPORT': (CONF_NFS, 'lockd', 'udp-port', '$1'),
'RPCNFSDCOUNT': (CONF_NFS, 'nfsd', 'threads', '$1'),
'NFSD_V4_GRACE': (CONF_NFS, 'nfsd', 'grace-time', '$1'),
'NFSD_V4_LEASE': (CONF_NFS, 'nfsd', 'lease-time', '$1'),
'MOUNTD_PORT': (CONF_NFS, 'mountd', 'port', '$1'),
'STATD_PORT': (CONF_NFS, 'statd', 'port', '$1'),
'STATD_OUTGOING_PORT': (CONF_NFS, 'statd', 'outgoing-port', '$1'),
'STATD_HA_CALLOUT': (CONF_NFS, 'statd', 'ha-callout', '$1'),
'GSS_USE_PROXY': (CONF_NFS, 'gssd', 'use-gss-proxy', '$1')
}
def eprint(*args, **kwargs):
""" Print error to stderr """
print(*args, file=sys.stderr, **kwargs)
def makesub(param, value):
""" Variable substitution """
return param.replace('$1', value)
def set_value(value, entry):
""" Set a configuration value by running nfsconf tool"""
cfile, section, tag, param = entry
tag = makesub(tag, value)
param = makesub(param, value)
if param == '+':
param = value
if param == ',':
param = value
args = [CONF_TOOL, "--file", cfile, "--set", section, tag, param]
try:
subprocess.check_output(args, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
print("Error running nfs-conf tool:\n %s" % (e.output.decode()))
print("Args: %s\n" % args)
raise Exception
def convert_getopt(optname, options, optstring, longopts, conversions):
""" Parse option string into seperate config items
Take a getopt string and a table of conversions
parse it all and spit out the converted config
Keyword arguments:
options -- the argv string to convert
optstring -- getopt format option list
conversions -- table of translations
"""
optcount = 0
try:
args = options.strip('\"').split()
optlist, optargs = getopt.gnu_getopt(args, optstring, longopts=longopts)
except getopt.GetoptError as err:
eprint(err)
raise Exception
setlist = {}
for (k, v) in optlist:
if k in conversions:
# it's already been set once
param = conversions[k][3]
tag = k + makesub(conversions[k][2], v)
if tag in setlist:
value = setlist[tag][0]
# is it a cummulative entry
if param == '+':
value = str(int(value) + 1)
if param == ',':
value += "," + v
else:
if param == '+':
value = "1"
elif param == ',':
value = v
else:
value = v
setlist[tag] = (value, conversions[k])
else:
if v:
eprint("Ignoring unrecognised option %s=%s in %s" % (k, v, optname))
else:
eprint("Ignoring unrecognised option %s in %s" % (k, optname))
for v, c in setlist.values():
try:
set_value(v, c)
optcount += 1
except Exception:
raise
i = 1
for o in optargs:
opname = '$' + str(i)
if opname in conversions:
try:
set_value(o, conversions[opname])
optcount += 1
except Exception:
raise
else:
eprint("Unrecognised trailing arguments")
raise Exception
i += 1
return optcount
def map_values():
""" Main function """
mapcount = 0
# Lets load the old config
with open(SYSCONF_NFS) as cfile:
file_content = '[sysconf]\n' + cfile.read()
sysconfig = configparser.RawConfigParser()
sysconfig.read_string(file_content)
# Map all the getopt option lists
for (name, opts, lopts, conv) in GETOPT_MAPS:
if name in sysconfig['sysconf']:
try:
mapcount += convert_getopt(name, sysconfig['sysconf'][name], opts,
lopts, conv)
except Exception:
eprint("Error whilst converting %s to nfsconf options." % (name))
raise
# Map the single value options
for name, opts in VALUE_MAPS.items():
if name in sysconfig['sysconf']:
try:
value = sysconfig['sysconf'][name]
set_value(value.strip('\"'), opts)
mapcount += 1
except Exception:
raise
# All went well, move aside the old file
# but dont bother if there were no changes and
# an old config file already exists
backupfile = SYSCONF_NFS + SYSCONF_BACKUP
if mapcount > 0 or not os.path.exists(backupfile):
try:
os.replace(SYSCONF_NFS, backupfile)
except OSError as err:
eprint("Error moving old config %s: %s" % (SYSCONF_NFS, err))
raise
# Main routine
try:
map_values()
except Exception as e:
eprint(e)
eprint("Conversion failed. Please correct the error and try again.")
exit(1)

44
SOURCES/nfsconvert.sh Normal file
View File

@ -0,0 +1,44 @@
#!/bin/bash
#
# Convert /etc/sysconfig/nfs values in /etc/nfs.conf valuse
#
#
# No file no conversion
#
if [ ! -f /etc/sysconfig/nfs ]; then
exit 0
fi
#
# See if the conversion happen already
#
grep "nfs.conf" /etc/sysconfig/nfs > /dev/null
if [ $? -eq 0 ]; then
exit 0
fi
if [ -f /etc/nfs.conf.rpmnew ]; then
# See if it is the we want to use
grep tag1234 /etc/nfs.conf.rpmnew > /dev/null
if [ $? -eq 0 ]; then
cp /etc/nfs.conf /etc/nfs.conf.rpmsave
cat /etc/nfs.conf.rpmnew | sed '/tag123/d' > /etc/nfs.conf
rm /etc/nfs.conf.rpmnew
fi
else
cp /etc/nfs.conf /etc/nfs.conf.rpmsave
fi
#
# Do the conversion
#
/usr/sbin/nfsconvert
#
# Make sure the modes are correct
#
if [ $? -eq 0 ]; then
chmod 644 /etc/nfs.conf
fi

1979
SPECS/nfs-utils.spec Normal file

File diff suppressed because it is too large Load Diff