Updated to the latest RC release: nfs-utils-2-4-4-rc1.patch (bz 1807999)

Signed-off-by: Steve Dickson <steved@redhat.com>
This commit is contained in:
Steve Dickson 2020-03-03 09:08:14 -05:00
parent 0a8ddb04a7
commit a96b6092ea
5 changed files with 152 additions and 2109 deletions

View File

@ -1,524 +0,0 @@
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/nfs.conf b/nfs.conf
index 0d0ec9b..796bee4 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -2,15 +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
# avoid-dns=1
# limit-to-legacy-enctypes=0
# context-timeout=0
@@ -19,11 +20,11 @@
# cred-cache-directory=
# preferred-realm=
#
-#[lockd]
+[lockd]
# port=0
# udp-port=0
#
-#[mountd]
+[mountd]
# debug=0
# manage_gids=n
# descriptors=0
@@ -33,11 +34,11 @@
# state-directory-path=/var/lib/nfs
# ha-callout=
#
-#[nfsdcltrack]
+[nfsdcltrack]
# debug=0
# storagedir=/var/lib/nfs/nfsdcltrack
#
-#[nfsd]
+[nfsd]
# debug=0
# threads=8
# host=
@@ -54,7 +55,7 @@
# vers4.2=y
# rdma=n
#
-#[statd]
+[statd]
# debug=0
# port=0
# outgoing-port=0
@@ -62,12 +63,12 @@
# 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]
+[svcgssd]
# principal=
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/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/gssd/gssd.c b/utils/gssd/gssd.c
index 2c14e5f..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
@@ -888,6 +890,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':
@@ -954,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;
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..91c0253 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -36,7 +36,7 @@
#include <sys/types.h>
#include <sys/time.h>
-#include <sys/poll.h>
+#include <sys/inotify.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <time.h>
@@ -205,15 +205,16 @@ static void usage(char *progname)
int
main(int argc, char **argv)
{
- int fd = 0, opt, fg = 0, nfsdret = -1;
+ int wd = -1, opt, fg = 0, nfsdret = -1;
struct idmap_clientq icq;
- struct event rootdirev, clntdirev, svrdirev;
+ struct event rootdirev, clntdirev, svrdirev, inotifyev;
struct event initialize;
struct passwd *pw;
struct group *gr;
struct stat sb;
char *xpipefsdir = NULL;
int serverstart = 1, clientstart = 1;
+ int inotify_fd;
int ret;
char *progname;
char *conf_path = NULL;
@@ -261,6 +262,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 +281,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)
@@ -373,18 +382,15 @@ main(int argc, char **argv)
}
}
- if ((fd = open(pipefsdir, O_RDONLY)) == -1)
- xlog_err("main: open(%s): %s", pipefsdir, strerror(errno));
-
- if (fcntl(fd, F_SETSIG, SIGUSR1) == -1)
- xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
-
- if (fcntl(fd, F_NOTIFY,
- DN_CREATE | DN_DELETE | DN_MODIFY | DN_MULTISHOT) == -1) {
- xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
- if (errno == EINVAL)
- xlog_err("main: Possibly no Dnotify support in kernel.");
+ inotify_fd = inotify_init1(IN_NONBLOCK);
+ if (inotify_fd == -1) {
+ xlog_err("Unable to initialise inotify_init1: %s\n", strerror(errno));
+ } else {
+ wd = inotify_add_watch(inotify_fd, pipefsdir, IN_CREATE | IN_DELETE | IN_MODIFY);
+ if (wd < 0)
+ xlog_err("Unable to inotify_add_watch(%s): %s\n", pipefsdir, strerror(errno));
}
+
TAILQ_INIT(&icq);
/* These events are persistent */
@@ -394,6 +400,10 @@ main(int argc, char **argv)
signal_add(&clntdirev, NULL);
signal_set(&svrdirev, SIGHUP, svrreopen, NULL);
signal_add(&svrdirev, NULL);
+ if ( wd >= 0) {
+ event_set(&inotifyev, inotify_fd, EV_READ, dirscancb, &icq);
+ event_add(&inotifyev, NULL);
+ }
/* Fetch current state */
/* (Delay till start of event_dispatch to avoid possibly losing
@@ -402,7 +412,7 @@ main(int argc, char **argv)
evtimer_add(&initialize, &now);
}
- if (nfsdret != 0 && fd == 0)
+ if (nfsdret != 0 && wd < 0)
xlog_err("main: Neither NFS client nor NFSd found");
daemon_ready();
diff --git a/utils/mount/Makefile.am b/utils/mount/Makefile.am
index 7b97c31..ad0be93 100644
--- a/utils/mount/Makefile.am
+++ b/utils/mount/Makefile.am
@@ -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 --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 4d2e37e..0a25b1f 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -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_info *mi)
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;
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/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
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

@ -1,828 +0,0 @@
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 e82ff14..4bf5aea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,12 +149,16 @@ AC_ARG_WITH(rpcgen,
[AC_HELP_STRING([--with-rpcgen=internal], [use internal rpcgen instead of system one])],
rpcgen_path=$withval,
rpcgen_path=yes )
+ rpcgen_cflags=-Werror=strict-prototypes
RPCGEN_PATH=
if test "$rpcgen_path" = "yes"; then
for p in /usr/local/bin/rpcgen /usr/bin/rpcgen /bin/rpcgen
do if test -f $p ; then RPCGEN_PATH=$p ; break; fi ; done
elif test "$rpcgen_path" != "internal"; then
RPCGEN_PATH=$rpcgen_path
+ else
+ RPCGEN_PATH=internal
+ rpcgen_cflags=-Wstrict-prototypes
fi
AC_SUBST(RPCGEN_PATH)
AM_CONDITIONAL(CONFIG_RPCGEN, [test "$RPCGEN_PATH" = "internal"])
@@ -165,7 +169,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 +189,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],
@@ -238,13 +248,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
@@ -447,6 +450,7 @@ if test -n "$path_plugins" ; then
[Define this to change the plugins path])
fi
AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
+AC_SUBST(PATH_PLUGINS, "$path_plugins")
AC_SUBST(AM_CPPFLAGS, "$AM_CPPFLAGS")
AC_DEFINE([HAVE_NFS4_SET_DEBUG], 1,
@@ -547,7 +551,7 @@ my_am_cflags="\
-pipe \
-Wall \
-Wextra \
- -Werror=strict-prototypes \
+ $rpcgen_cflags \
-Werror=missing-prototypes \
-Werror=missing-declarations \
-Werror=format=2 \
@@ -631,7 +635,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/nfs.conf b/nfs.conf
index 0d0ec9b..796bee4 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -2,15 +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
# avoid-dns=1
# limit-to-legacy-enctypes=0
# context-timeout=0
@@ -19,11 +20,11 @@
# cred-cache-directory=
# preferred-realm=
#
-#[lockd]
+[lockd]
# port=0
# udp-port=0
#
-#[mountd]
+[mountd]
# debug=0
# manage_gids=n
# descriptors=0
@@ -33,11 +34,11 @@
# state-directory-path=/var/lib/nfs
# ha-callout=
#
-#[nfsdcltrack]
+[nfsdcltrack]
# debug=0
# storagedir=/var/lib/nfs/nfsdcltrack
#
-#[nfsd]
+[nfsd]
# debug=0
# threads=8
# host=
@@ -54,7 +55,7 @@
# vers4.2=y
# rdma=n
#
-#[statd]
+[statd]
# debug=0
# port=0
# outgoing-port=0
@@ -62,12 +63,12 @@
# 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]
+[svcgssd]
# principal=
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/support/nfs/conffile.c b/support/nfs/conffile.c
index 3845b94..77c5790 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -405,11 +405,6 @@ conf_parse_line(int trans, char *line, const char *filename, int lineno, char **
"missing tag in assignment", filename, lineno);
return;
}
- if (*val == '\0') {
- xlog_warn("config error at %s:%d: "
- "missing value in assignment", filename, lineno);
- return;
- }
if (strcasecmp(line, "include")==0) {
/* load and parse subordinate config files */
@@ -1830,6 +1825,8 @@ conf_write(const char *filename, const char *section, const char *arg,
/* this is the section we care about */
if (where != NULL && is_section(where->text, section, arg)) {
+ struct outbuffer *section_start = where;
+
/* is there an existing assignment */
while ((where = TAILQ_NEXT(where, link)) != NULL) {
if (is_tag(where->text, tag)) {
@@ -1838,6 +1835,28 @@ conf_write(const char *filename, const char *section, const char *arg,
}
}
+ /* no active assignment, but is there a commented one */
+ if (!found) {
+ where = section_start;
+ while ((where = TAILQ_NEXT(where, link)) != NULL) {
+ if (is_comment(where->text)) {
+ char *cline = where->text;
+ while (isspace(*cline))
+ cline++;
+
+ if (*cline != '#')
+ continue;
+ cline++;
+
+ if (is_tag(cline, tag)) {
+ found = true;
+ break;
+ }
+ }
+ }
+ }
+
+ /* replace the located tag with an updated one */
if (found) {
struct outbuffer *prev = TAILQ_PREV(where, tailhead, link);
bool again = false;
diff --git a/support/nfsidmap/Makefile.am b/support/nfsidmap/Makefile.am
index 8b5dfe4..cdbeb4c 100644
--- a/support/nfsidmap/Makefile.am
+++ b/support/nfsidmap/Makefile.am
@@ -1,4 +1,4 @@
-pkgplugindir=$(libdir)/libnfsidmap
+pkgplugindir=$(PATH_PLUGINS)
if ENABLE_LDAP
UMICH_LDAP_LIB = umich_ldap.la
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/systemd/rpc-statd.service b/systemd/rpc-statd.service
index f41ae20..3e92cf7 100644
--- a/systemd/rpc-statd.service
+++ b/systemd/rpc-statd.service
@@ -4,9 +4,11 @@ DefaultDependencies=no
Conflicts=umount.target
Requires=nss-lookup.target rpcbind.socket
Wants=network-online.target
+Wants=rpc-statd-notify.service
After=network-online.target nss-lookup.target rpcbind.socket
PartOf=nfs-utils.service
+IgnoreOnIsolate=yes
[Service]
Environment=RPC_STATD_NO_NOTIFY=1
diff --git a/tests/nfsconf/01-errors.exp b/tests/nfsconf/01-errors.exp
index 2bf1b8c..0b985b4 100644
--- a/tests/nfsconf/01-errors.exp
+++ b/tests/nfsconf/01-errors.exp
@@ -4,7 +4,6 @@ nfsconf: config error at 01-errors.conf:10: non-matched ']', ignoring until next
nfsconf: config error at 01-errors.conf:11: ignoring line not in a section
nfsconf: config error at 01-errors.conf:14: line not empty and not an assignment
nfsconf: config error at 01-errors.conf:15: missing tag in assignment
-nfsconf: config error at 01-errors.conf:16: missing value in assignment
nfsconf: config error at 01-errors.conf:18: unmatched quotes
[four]
four = foo = bar
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/gssd/gssd.c b/utils/gssd/gssd.c
index 2c14e5f..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
@@ -888,6 +890,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':
@@ -954,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;
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..91c0253 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -36,7 +36,7 @@
#include <sys/types.h>
#include <sys/time.h>
-#include <sys/poll.h>
+#include <sys/inotify.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <time.h>
@@ -205,15 +205,16 @@ static void usage(char *progname)
int
main(int argc, char **argv)
{
- int fd = 0, opt, fg = 0, nfsdret = -1;
+ int wd = -1, opt, fg = 0, nfsdret = -1;
struct idmap_clientq icq;
- struct event rootdirev, clntdirev, svrdirev;
+ struct event rootdirev, clntdirev, svrdirev, inotifyev;
struct event initialize;
struct passwd *pw;
struct group *gr;
struct stat sb;
char *xpipefsdir = NULL;
int serverstart = 1, clientstart = 1;
+ int inotify_fd;
int ret;
char *progname;
char *conf_path = NULL;
@@ -261,6 +262,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 +281,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)
@@ -373,18 +382,15 @@ main(int argc, char **argv)
}
}
- if ((fd = open(pipefsdir, O_RDONLY)) == -1)
- xlog_err("main: open(%s): %s", pipefsdir, strerror(errno));
-
- if (fcntl(fd, F_SETSIG, SIGUSR1) == -1)
- xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
-
- if (fcntl(fd, F_NOTIFY,
- DN_CREATE | DN_DELETE | DN_MODIFY | DN_MULTISHOT) == -1) {
- xlog_err("main: fcntl(%s): %s", pipefsdir, strerror(errno));
- if (errno == EINVAL)
- xlog_err("main: Possibly no Dnotify support in kernel.");
+ inotify_fd = inotify_init1(IN_NONBLOCK);
+ if (inotify_fd == -1) {
+ xlog_err("Unable to initialise inotify_init1: %s\n", strerror(errno));
+ } else {
+ wd = inotify_add_watch(inotify_fd, pipefsdir, IN_CREATE | IN_DELETE | IN_MODIFY);
+ if (wd < 0)
+ xlog_err("Unable to inotify_add_watch(%s): %s\n", pipefsdir, strerror(errno));
}
+
TAILQ_INIT(&icq);
/* These events are persistent */
@@ -394,6 +400,10 @@ main(int argc, char **argv)
signal_add(&clntdirev, NULL);
signal_set(&svrdirev, SIGHUP, svrreopen, NULL);
signal_add(&svrdirev, NULL);
+ if ( wd >= 0) {
+ event_set(&inotifyev, inotify_fd, EV_READ, dirscancb, &icq);
+ event_add(&inotifyev, NULL);
+ }
/* Fetch current state */
/* (Delay till start of event_dispatch to avoid possibly losing
@@ -402,7 +412,7 @@ main(int argc, char **argv)
evtimer_add(&initialize, &now);
}
- if (nfsdret != 0 && fd == 0)
+ if (nfsdret != 0 && wd < 0)
xlog_err("main: Neither NFS client nor NFSd found");
daemon_ready();
diff --git a/utils/mount/Makefile.am b/utils/mount/Makefile.am
index 7b97c31..ad0be93 100644
--- a/utils/mount/Makefile.am
+++ b/utils/mount/Makefile.am
@@ -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 --git a/utils/mount/error.c b/utils/mount/error.c
index c9797fc..dfe5c7d 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -223,7 +223,7 @@ void mount_error(const char *spec, const char *mount_point, int error)
progname, mount_point);
break;
case EBUSY:
- nfs_error(_("%s: %s is busy or already mounted"),
+ nfs_error(_("%s: %s is busy or already mounted or sharecache fail"),
progname, mount_point);
break;
case ENOENT:
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 4d2e37e..0a25b1f 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -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_info *mi)
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;
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/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/nfsref/Makefile.am b/utils/nfsref/Makefile.am
index 2b2bb53..44edc83 100644
--- a/utils/nfsref/Makefile.am
+++ b/utils/nfsref/Makefile.am
@@ -35,5 +35,3 @@ man8_MANS = nfsref.man
MAINTAINERCLEANFILES = Makefile.in
-AM_CPPFLAGS = -I. -I../../support/include
-##AM_LDFLAGS = -Wl,--as-needed
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
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) {
diff --git a/utils/statd/start-statd b/utils/statd/start-statd
index 82715b4..54ced82 100755
--- a/utils/statd/start-statd
+++ b/utils/statd/start-statd
@@ -20,7 +20,12 @@ fi
# First try systemd if it's installed.
if [ -d /run/systemd/system ]; then
# Quit only if the call worked.
- systemctl start rpc-statd.service && exit
+ if systemctl start rpc-statd.service; then
+ # Ensure systemd knows not to stop rpc.statd or its dependencies
+ # on 'systemctl isolate ..'
+ systemctl add-wants --runtime remote-fs.target rpc-statd.service
+ exit 0
+ fi
fi
cd /

View File

@ -1,756 +0,0 @@
diff --git a/aclocal/kerberos5.m4 b/aclocal/kerberos5.m4
index 8a0f3e4..faa5804 100644
--- a/aclocal/kerberos5.m4
+++ b/aclocal/kerberos5.m4
@@ -38,9 +38,11 @@ AC_DEFUN([AC_KERBEROS_V5],[
AC_DEFINE_UNQUOTED(KRB5_VERSION, $K5VERS, [Define this as the Kerberos version number])
if test -f $dir/include/gssapi/gssapi_krb5.h -a \
\( -f $dir/lib/libgssapi_krb5.a -o \
+ -f $dir/lib/libgssapi_krb5.so -o \
+ -f $dir/lib32/libgssapi_krb5.a -o \
+ -f $dir/lib32/libgssapi_krb5.so -o \
-f $dir/lib64/libgssapi_krb5.a -o \
- -f $dir/lib64/libgssapi_krb5.so -o \
- -f $dir/lib/libgssapi_krb5.so \) ; then
+ -f $dir/lib64/libgssapi_krb5.so \) ; then
AC_DEFINE(HAVE_KRB5, 1, [Define this if you have MIT Kerberos libraries])
KRBDIR="$dir"
gssapi_lib=gssapi_krb5
diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c
index 84e4802..f078a66 100644
--- a/support/misc/nfsd_path.c
+++ b/support/misc/nfsd_path.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -5,7 +9,6 @@
#include <stdlib.h>
#include <unistd.h>
-#include "config.h"
#include "conffile.h"
#include "xmalloc.h"
#include "xlog.h"
diff --git a/support/misc/xstat.c b/support/misc/xstat.c
index fa04788..4c997ee 100644
--- a/support/misc/xstat.c
+++ b/support/misc/xstat.c
@@ -1,3 +1,7 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <errno.h>
#include <sys/types.h>
#include <fcntl.h>
@@ -5,7 +9,6 @@
#include <sys/sysmacros.h>
#include <unistd.h>
-#include "config.h"
#include "xstat.h"
#ifdef HAVE_FSTATAT
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)
diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index 7b8a871..9299e65 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -486,6 +486,9 @@ out:
if (gss_methods)
conf_free_list(gss_methods);
+ if (nfs4_methods)
+ conf_free_list(nfs4_methods);
+
return ret ? -ENOENT: 0;
}
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 <ctype.h>
#include <stdio.h>
#include <mntent.h>
+#include <alloca.h>
#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) +
diff --git a/tests/statdb_dump.c b/tests/statdb_dump.c
index 92d63f2..3ac12bf 100644
--- a/tests/statdb_dump.c
+++ b/tests/statdb_dump.c
@@ -23,6 +23,7 @@
#include "config.h"
#endif
+#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <arpa/inet.h>
diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py
index 2f525f4..6ac83cc 100755
--- a/tools/mountstats/mountstats.py
+++ b/tools/mountstats/mountstats.py
@@ -308,6 +308,8 @@ class DeviceData:
op = words[0][:-1]
self.__rpc_data['ops'] += [op]
self.__rpc_data[op] = [int(word) for word in words[1:]]
+ if len(self.__rpc_data[op]) < 9:
+ self.__rpc_data[op] += [0]
def parse_stats(self, lines):
"""Turn a list of lines from a mount stat file into a
@@ -582,7 +584,7 @@ class DeviceData:
self.__nfs_data['fstype'] = 'nfs4'
self.__rpc_data['ops'] = ops
for op in ops:
- self.__rpc_data[op] = [0 for i in range(8)]
+ self.__rpc_data[op] = [0 for i in range(9)]
def accumulate_iostats(self, new_stats):
"""Accumulate counters from all RPC op buckets in new_stats. This is
@@ -607,6 +609,8 @@ class DeviceData:
queued_for = float(rpc_stats[5])
rtt = float(rpc_stats[6])
exe = float(rpc_stats[7])
+ if len(rpc_stats) >= 9:
+ errs = int(rpc_stats[8])
# prevent floating point exceptions
if ops != 0:
@@ -615,12 +619,15 @@ class DeviceData:
rtt_per_op = rtt / ops
exe_per_op = exe / ops
queued_for_per_op = queued_for / ops
+ if len(rpc_stats) >= 9:
+ errs_percent = (errs * 100) / ops
else:
kb_per_op = 0.0
retrans_percent = 0.0
rtt_per_op = 0.0
exe_per_op = 0.0
queued_for_per_op = 0.0
+ errs_percent = 0.0
op += ':'
print(format(op.lower(), '<16s'), end='')
@@ -630,7 +637,10 @@ class DeviceData:
print(format('retrans', '>16s'), end='')
print(format('avg RTT (ms)', '>16s'), end='')
print(format('avg exe (ms)', '>16s'), end='')
- print(format('avg queue (ms)', '>16s'))
+ print(format('avg queue (ms)', '>16s'), end='')
+ if len(rpc_stats) >= 9:
+ print(format('errors', '>16s'), end='')
+ print()
print(format((ops / sample_time), '>24.3f'), end='')
print(format((kilobytes / sample_time), '>16.3f'), end='')
@@ -639,7 +649,11 @@ class DeviceData:
print(format(retransmits, '>16'), end='')
print(format(rtt_per_op, '>16.3f'), end='')
print(format(exe_per_op, '>16.3f'), end='')
- print(format(queued_for_per_op, '>16.3f'))
+ print(format(queued_for_per_op, '>16.3f'), end='')
+ if len(rpc_stats) >= 9:
+ errors = '{0:>10.0f} ({1:>3.1f}%)'.format(errs, errs_percent).strip()
+ print(format(errors, '>16'), end='')
+ print()
def display_iostats(self, sample_time):
"""Display NFS and RPC stats in an iostat-like way
diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
old mode 100644
new mode 100755
index dec0e86..b7e98a2
--- a/tools/nfs-iostat/nfs-iostat.py
+++ b/tools/nfs-iostat/nfs-iostat.py
@@ -329,6 +329,8 @@ class DeviceData:
queued_for = float(rpc_stats[5])
rtt = float(rpc_stats[6])
exe = float(rpc_stats[7])
+ if len(rpc_stats) >= 9:
+ errs = float(rpc_stats[8])
# prevent floating point exceptions
if ops != 0:
@@ -337,12 +339,16 @@ class DeviceData:
rtt_per_op = rtt / ops
exe_per_op = exe / ops
queued_for_per_op = queued_for / ops
+ if len(rpc_stats) >= 9:
+ errs_percent = (errs * 100) / ops
else:
kb_per_op = 0.0
retrans_percent = 0.0
rtt_per_op = 0.0
exe_per_op = 0.0
queued_for_per_op = 0.0
+ if len(rpc_stats) >= 9:
+ errs_percent = 0.0
op += ':'
print(format(op.lower(), '<16s'), end='')
@@ -352,7 +358,10 @@ class DeviceData:
print(format('retrans', '>16s'), end='')
print(format('avg RTT (ms)', '>16s'), end='')
print(format('avg exe (ms)', '>16s'), end='')
- print(format('avg queue (ms)', '>16s'))
+ print(format('avg queue (ms)', '>16s'), end='')
+ if len(rpc_stats) >= 9:
+ print(format('errors', '>16s'), end='')
+ print()
print(format((ops / sample_time), '>24.3f'), end='')
print(format((kilobytes / sample_time), '>16.3f'), end='')
@@ -361,7 +370,11 @@ class DeviceData:
print(format(retransmits, '>16'), end='')
print(format(rtt_per_op, '>16.3f'), end='')
print(format(exe_per_op, '>16.3f'), end='')
- print(format(queued_for_per_op, '>16.3f'))
+ print(format(queued_for_per_op, '>16.3f'), end='')
+ if len(rpc_stats) >= 9:
+ errors = '{0:>10.0f} ({1:>3.1f}%)'.format(errs, errs_percent).strip()
+ print(format(errors, '>16'), end='')
+ print()
def ops(self, sample_time):
sends = float(self.__rpc_data['rpcsends'])
diff --git a/tools/nfs-iostat/nfsiostat.man b/tools/nfs-iostat/nfsiostat.man
index 9ae94c5..940c043 100644
--- a/tools/nfs-iostat/nfsiostat.man
+++ b/tools/nfs-iostat/nfsiostat.man
@@ -97,6 +97,14 @@ This is the duration from the time the NFS client created the RPC request task t
.RE
.RE
.RE
+.RS 8
+- \fBerrors\fR
+.RS
+This is the number of operations that completed with an error status (status < 0). This count is only available on kernels with RPC iostats version 1.1 or above.
+.RS
+.RE
+.RE
+.RE
.TP
Note that if an interval is used as argument to \fBnfsiostat\fR, then the diffrence from previous interval will be displayed, otherwise the results will be from the time that the share was mounted.
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index e811703..f5f9b10 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -26,6 +26,10 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
#include <sys/sysmacros.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -51,10 +55,6 @@
#include <errno.h>
#include <libdevmapper.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
#include "device-discovery.h"
#include "xcommon.h"
#include "nfslib.h"
diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man
index e620f0d..cc3a210 100644
--- a/utils/gssd/gssd.man
+++ b/utils/gssd/gssd.man
@@ -305,6 +305,14 @@ section of the
.I /etc/nfs.conf
configuration file. Values recognized include:
.TP
+.B verbosity
+Value which is equivalent to the number of
+.BR -v .
+.TP
+.B rpc-verbosity
+Value which is equivalent to the number of
+.BR -r .
+.TP
.B use-memcache
A Boolean flag equivalent to
.BR -M .
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index 454a6eb..0474783 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -912,6 +912,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
k5err = gssd_k5_err_msg(context, code);
printerr(3, "%s while getting keytab entry for '%s'\n",
k5err, spn);
+ free(k5err);
+ k5err = NULL;
/*
* We tried the active directory machine account
* with the hostname part as-is and failed...
@@ -1014,6 +1016,8 @@ query_krb5_ccache(const char* cred_cache, char **ret_princname,
char *str = NULL;
char *princstring;
+ *ret_princname = *ret_realm = NULL;
+
ret = krb5_init_context(&context);
if (ret)
return 0;
@@ -1048,7 +1052,7 @@ err_princ:
krb5_cc_close(context, ccache);
err_cache:
krb5_free_context(context);
- return found;
+ return (*ret_princname && *ret_realm);
}
/*==========================*/
@@ -1231,6 +1235,8 @@ gssd_destroy_krb5_machine_creds(void)
k5err = gssd_k5_err_msg(context, code);
printerr(0, "WARNING: %s while destroying credential "
"cache '%s'\n", k5err, ple->ccname);
+ free(k5err);
+ k5err = NULL;
}
}
krb5_free_context(context);
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index 62e37b8..c187e7d 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -34,6 +34,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
+
#include <sys/types.h>
#include <sys/time.h>
#include <sys/inotify.h>
@@ -62,10 +66,6 @@
#include <libgen.h>
#include <nfsidmap.h>
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif /* HAVE_CONFIG_H */
-
#include "xlog.h"
#include "conffile.h"
#include "queue.h"
@@ -520,14 +520,16 @@ static void
clntscancb(int UNUSED(fd), short UNUSED(which), void *data)
{
struct idmap_clientq *icq = data;
- struct idmap_client *ic;
+ struct idmap_client *ic, *ic_next;
- TAILQ_FOREACH(ic, icq, ic_next)
+ for (ic = TAILQ_FIRST(icq); ic != NULL; ic = ic_next) {
+ ic_next = TAILQ_NEXT(ic, ic_next);
if (ic->ic_fd == -1 && nfsopen(ic) == -1) {
close(ic->ic_dirfd);
TAILQ_REMOVE(icq, ic, ic_next);
free(ic);
}
+ }
}
static void
diff --git a/utils/mount/network.c b/utils/mount/network.c
index e166a82..6ac913d 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -39,7 +39,7 @@
#include <sys/socket.h>
#include <sys/wait.h>
#include <sys/stat.h>
-#if defined(__GLIBC__) && (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)
+#if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24))
/* Cannot safely include linux/in6.h in old glibc, so hardcode the needed values */
# define IPV6_PREFER_SRC_PUBLIC 2
# define IPV6_ADDR_PREFERENCES 72
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/utils/nfsdcld/legacy.c b/utils/nfsdcld/legacy.c
index f0ca316..07f477a 100644
--- a/utils/nfsdcld/legacy.c
+++ b/utils/nfsdcld/legacy.c
@@ -24,6 +24,7 @@
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <limits.h>
#include "cld.h"
#include "sqlite.h"
#include "xlog.h"
diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c
index cd658ef..fa81df8 100644
--- a/utils/nfsdcld/sqlite.c
+++ b/utils/nfsdcld/sqlite.c
@@ -67,6 +67,7 @@
#include "cld-internal.h"
#include "conffile.h"
#include "legacy.h"
+#include "nfslib.h"
#define CLD_SQLITE_LATEST_SCHEMA_VERSION 3
#define CLTRACK_DEFAULT_STORAGEDIR NFS_STATEDIR "/nfsdcltrack"
@@ -448,6 +449,129 @@ out:
return ret;
}
+/*
+ * Helper for renaming a recovery table to fix the padding.
+ */
+static int
+sqlite_fix_table_name(const char *name)
+{
+ int ret;
+ uint64_t val;
+ char *err;
+
+ if (sscanf(name, "rec-%" PRIx64, &val) != 1)
+ return -EINVAL;
+ ret = snprintf(buf, sizeof(buf), "ALTER TABLE \"%s\" "
+ "RENAME TO \"rec-%016" PRIx64 "\";",
+ name, val);
+ if (ret < 0) {
+ xlog(L_ERROR, "sprintf failed!");
+ return -EINVAL;
+ } else if ((size_t)ret >= sizeof(buf)) {
+ xlog(L_ERROR, "sprintf output too long! (%d chars)", ret);
+ return -EINVAL;
+ }
+ ret = sqlite3_exec(dbh, (const char *)buf, NULL, NULL, &err);
+ if (ret != SQLITE_OK) {
+ xlog(L_ERROR, "Unable to fix table for epoch %d: %s",
+ val, err);
+ goto out;
+ }
+ xlog(D_GENERAL, "Renamed table %s to rec-%016" PRIx64, name, val);
+out:
+ sqlite3_free(err);
+ return ret;
+}
+
+/*
+ * Callback for the sqlite_exec statement in sqlite_check_table_names.
+ * If the epoch encoded in the table name matches either the current
+ * epoch or the recovery epoch, then try to fix the padding. Otherwise,
+ * we bail.
+ */
+static int
+sqlite_check_table_names_cb(void *UNUSED(arg), int ncols, char **cols,
+ char **UNUSED(colnames))
+{
+ int ret = SQLITE_OK;
+ uint64_t val;
+
+ if (ncols > 1)
+ return -EINVAL;
+ if (sscanf(cols[0], "rec-%" PRIx64, &val) != 1)
+ return -EINVAL;
+ if (val == current_epoch || val == recovery_epoch) {
+ xlog(D_GENERAL, "found invalid table name %s for %s epoch",
+ cols[0], val == current_epoch ? "current" : "recovery");
+ ret = sqlite_fix_table_name(cols[0]);
+ } else {
+ xlog(L_ERROR, "found invalid table name %s for unknown epoch %"
+ PRId64, cols[0], val);
+ return -EINVAL;
+ }
+ return ret;
+}
+
+/*
+ * Look for recovery table names where the epoch isn't zero-padded
+ */
+static int
+sqlite_check_table_names(void)
+{
+ int ret;
+ char *err;
+
+ ret = sqlite3_exec(dbh, "SELECT name FROM sqlite_master "
+ "WHERE type=\"table\" AND name LIKE \"%rec-%\" "
+ "AND length(name) < 20;",
+ sqlite_check_table_names_cb, NULL, &err);
+ if (ret != SQLITE_OK) {
+ xlog(L_ERROR, "Table names check failed: %s", err);
+ }
+ sqlite3_free(err);
+ return ret;
+}
+
+/*
+ * Simple db health check. For now we're just making sure that the recovery
+ * table names are of the format "rec-CCCCCCCCCCCCCCCC" (where C is the hex
+ * representation of the epoch value) and that epoch value matches either
+ * the current epoch or the recovery epoch.
+ */
+static int
+sqlite_check_db_health(void)
+{
+ int ret, ret2;
+ char *err;
+
+ ret = sqlite3_exec(dbh, "BEGIN EXCLUSIVE TRANSACTION;", NULL, NULL,
+ &err);
+ if (ret != SQLITE_OK) {
+ xlog(L_ERROR, "Unable to begin transaction: %s", err);
+ goto rollback;
+ }
+
+ ret = sqlite_check_table_names();
+ if (ret != SQLITE_OK)
+ goto rollback;
+
+ ret = sqlite3_exec(dbh, "COMMIT TRANSACTION;", NULL, NULL, &err);
+ if (ret != SQLITE_OK) {
+ xlog(L_ERROR, "Unable to commit transaction: %s", err);
+ goto rollback;
+ }
+
+cleanup:
+ sqlite3_free(err);
+ xlog(D_GENERAL, "%s: returning %d", __func__, ret);
+ return ret;
+rollback:
+ ret2 = sqlite3_exec(dbh, "ROLLBACK TRANSACTION;", NULL, NULL, &err);
+ if (ret2 != SQLITE_OK)
+ xlog(L_ERROR, "Unable to rollback transaction: %s", err);
+ goto cleanup;
+}
+
static int
sqlite_attach_db(const char *path)
{
@@ -536,7 +660,7 @@ sqlite_copy_cltrack_records(int *num_rec)
xlog(L_ERROR, "Unable to begin transaction: %s", err);
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\";",
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016" PRIx64 "\";",
current_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -551,7 +675,7 @@ sqlite_copy_cltrack_records(int *num_rec)
xlog(L_ERROR, "Unable to clear records from current epoch: %s", err);
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%" PRIx64 "\" "
+ ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%016" PRIx64 "\" "
"SELECT id FROM attached.clients;",
current_epoch);
if (ret < 0) {
@@ -673,6 +797,13 @@ sqlite_prepare_dbh(const char *topdir)
if (ret)
goto out_close;
+ ret = sqlite_check_db_health();
+ if (ret) {
+ xlog(L_ERROR, "Database health check failed! "
+ "Database must be fixed manually.");
+ goto out_close;
+ }
+
/* one-time "upgrade" from older client tracking methods */
if (first_time) {
sqlite_copy_cltrack_records(&num_cltrack_records);
@@ -704,7 +835,7 @@ sqlite_insert_client(const unsigned char *clname, const size_t namelen)
int ret;
sqlite3_stmt *stmt = NULL;
- ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%" PRIx64 "\" "
+ ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%016" PRIx64 "\" "
"VALUES (?);", current_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -749,7 +880,7 @@ sqlite_remove_client(const unsigned char *clname, const size_t namelen)
int ret;
sqlite3_stmt *stmt = NULL;
- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\" "
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016" PRIx64 "\" "
"WHERE id==?;", current_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -799,7 +930,7 @@ sqlite_check_client(const unsigned char *clname, const size_t namelen)
int ret;
sqlite3_stmt *stmt = NULL;
- ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%" PRIx64 "\" "
+ ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%016" PRIx64 "\" "
"WHERE id==?;", recovery_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -892,7 +1023,7 @@ sqlite_grace_start(void)
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%" PRIx64 "\" "
+ ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%016" PRIx64 "\" "
"(id BLOB PRIMARY KEY);",
tcur);
if (ret < 0) {
@@ -916,7 +1047,7 @@ sqlite_grace_start(void)
* values in the grace table, just clear out the records for
* the current reboot epoch.
*/
- ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\";",
+ ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016" PRIx64 "\";",
tcur);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -977,7 +1108,7 @@ sqlite_grace_done(void)
goto rollback;
}
- ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%" PRIx64 "\";",
+ ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%016" PRIx64 "\";",
recovery_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
@@ -1028,7 +1159,7 @@ sqlite_iterate_recovery(int (*cb)(struct cld_client *clnt), struct cld_client *c
return -EINVAL;
}
- ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%" PRIx64 "\";",
+ ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%016" PRIx64 "\";",
recovery_epoch);
if (ret < 0) {
xlog(L_ERROR, "sprintf failed!");
diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c
index 9400048..20c8ebd 100644
--- a/utils/statd/monitor.c
+++ b/utils/statd/monitor.c
@@ -66,7 +66,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
*my_name = argp->mon_id.my_id.my_name;
struct my_id *id = &argp->mon_id.my_id;
char *cp;
- notify_list *clnt;
+ notify_list *clnt = NULL;
struct sockaddr_in my_addr = {
.sin_family = AF_INET,
.sin_addr.s_addr = htonl(INADDR_LOOPBACK),
@@ -177,6 +177,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
* We're committed...ignoring errors. Let's hope that a malloc()
* doesn't fail. (I should probably fix this assumption.)
*/
+ clnt = NULL;
if (!existing && !(clnt = nlist_new(my_name, mon_name, 0))) {
free(dnsname);
xlog_warn("out of memory");
@@ -223,6 +224,7 @@ sm_mon_1_svc(struct mon *argp, struct svc_req *rqstp)
failure:
xlog_warn("STAT_FAIL to %s for SM_MON of %s", my_name, mon_name);
+ free(clnt);
return (&result);
}
@@ -242,6 +244,7 @@ load_one_host(const char *hostname,
clnt->dns_name = strdup(hostname);
if (clnt->dns_name == NULL) {
nlist_free(NULL, clnt);
+ free(clnt);
return 0;
}
diff --git a/utils/statd/notlist.c b/utils/statd/notlist.c
index 0341c15..45879a4 100644
--- a/utils/statd/notlist.c
+++ b/utils/statd/notlist.c
@@ -210,7 +210,6 @@ nlist_free(notify_list **head, notify_list *entry)
if (NL_MON_NAME(entry))
free(NL_MON_NAME(entry));
free(entry->dns_name);
- free(entry);
}
/*
@@ -219,8 +218,14 @@ nlist_free(notify_list **head, notify_list *entry)
void
nlist_kill(notify_list **head)
{
- while (*head)
+ notify_list *next;
+
+ while (*head) {
+ next = (*head)->next;
nlist_free(head, *head);
+ free(*head);
+ *head = next;
+ }
}
/*

146
nfs-utils.2.4.4-rc1.patch Normal file
View File

@ -0,0 +1,146 @@
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index a1c43d2..8c73748 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -484,7 +484,7 @@ gssd_get_single_krb5_cred(krb5_context context,
if (ccache)
krb5_cc_close(context, ccache);
krb5_free_cred_contents(context, &my_creds);
- free(k5err);
+ krb5_free_string(context, k5err);
return (code);
}
@@ -723,7 +723,7 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
"we failed to unparse principal name: %s\n",
k5err);
k5_free_kt_entry(context, kte);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
continue;
}
@@ -770,7 +770,7 @@ gssd_search_krb5_keytab(krb5_context context, krb5_keytab kt,
if (retval < 0)
retval = 0;
out:
- free(k5err);
+ krb5_free_string(context, k5err);
return retval;
}
@@ -799,7 +799,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
int tried_all = 0, tried_default = 0, tried_upper = 0;
krb5_principal princ;
const char *notsetstr = "not set";
- char *adhostoverride;
+ char *adhostoverride = NULL;
/* Get full target hostname */
@@ -827,7 +827,6 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
adhostoverride);
/* No overflow: Windows cannot handle strings longer than 19 chars */
strcpy(myhostad, adhostoverride);
- free(adhostoverride);
} else {
strcpy(myhostad, myhostname);
for (i = 0; myhostad[i] != 0; ++i) {
@@ -836,6 +835,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
myhostad[i] = '$';
myhostad[i+1] = 0;
}
+ if (adhostoverride)
+ krb5_free_string(context, adhostoverride);
if (!srchost) {
retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname));
@@ -926,7 +927,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
k5err = gssd_k5_err_msg(context, code);
printerr(1, "%s while building principal for '%s'\n",
k5err, spn);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
continue;
}
@@ -936,7 +937,7 @@ find_keytab_entry(krb5_context context, krb5_keytab kt,
k5err = gssd_k5_err_msg(context, code);
printerr(3, "%s while getting keytab entry for '%s'\n",
k5err, spn);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
/*
* We tried the active directory machine account
@@ -985,7 +986,7 @@ out:
k5_free_default_realm(context, default_realm);
if (realmnames)
krb5_free_host_realm(context, realmnames);
- free(k5err);
+ krb5_free_string(context, k5err);
return retval;
}
@@ -1248,7 +1249,7 @@ gssd_destroy_krb5_machine_creds(void)
printerr(0, "WARNING: %s while resolving credential "
"cache '%s' for destruction\n", k5err,
ple->ccname);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
continue;
}
@@ -1257,13 +1258,13 @@ gssd_destroy_krb5_machine_creds(void)
k5err = gssd_k5_err_msg(context, code);
printerr(0, "WARNING: %s while destroying credential "
"cache '%s'\n", k5err, ple->ccname);
- free(k5err);
+ krb5_free_string(context, k5err);
k5err = NULL;
}
}
krb5_free_context(context);
out:
- free(k5err);
+ krb5_free_string(context, k5err);
}
/*
@@ -1346,7 +1347,7 @@ out_free_kt:
out_free_context:
krb5_free_context(context);
out:
- free(k5err);
+ krb5_free_string(context, k5err);
return retval;
}
diff --git a/utils/mount/mount.c b/utils/mount/mount.c
index 2be3dc2..b98f9e0 100644
--- a/utils/mount/mount.c
+++ b/utils/mount/mount.c
@@ -393,11 +393,6 @@ int main(int argc, char *argv[])
if(!strncmp(progname, "umount", strlen("umount")))
exit(nfsumount(argc, argv));
- if ((argc < 3)) {
- mount_usage();
- exit(EX_USAGE);
- }
-
mount_config_init(progname);
while ((c = getopt_long(argc, argv, "rvVwfno:hs",
@@ -437,6 +432,11 @@ int main(int argc, char *argv[])
}
}
+ if ((argc < 3)) {
+ mount_usage();
+ exit(EX_USAGE);
+ }
+
/*
* Extra non-option words at the end are bogus...
*/

View File

@ -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.4.3
Release: 0%{?dist}
Release: 1.rc1%{?dist}
Epoch: 1
# group all 32bit related archs
@ -16,6 +16,8 @@ Source4: nfsconvert.py
Source5: nfsconvert.sh
Source6: nfs-convert.service
Patch001: nfs-utils.2.4.4-rc1.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
@ -364,6 +366,9 @@ fi
%{_pkgdir}/*/var-lib-nfs-rpc_pipefs.mount
%changelog
* Tue Mar 03 2020 Steve Dickson <steved@redhat.com> 2.4.3-1.rc1
- Updated to the latest RC release: nfs-utils-2-4-4-rc1.patch (bz 1807999)
* Mon Feb 10 2020 Steve Dickson <steved@redhat.com> 2.4.3-0
- Updated to latest upstream release: nfs-utils-2-4-3 (bz 1787831)
- Fix error in preuninstall scriptlet (bz 1785816)