!4 update the version from 2.3.3 to 2.4.2

Merge pull request !4 from hy/tmp
This commit is contained in:
openeuler-ci-bot 2020-01-12 18:49:46 +08:00 committed by Gitee
commit f1329e5fbe
54 changed files with 37 additions and 2051 deletions

View File

@ -1,12 +0,0 @@
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

@ -1,12 +0,0 @@
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

@ -1,203 +0,0 @@
diff -up nfs-utils-2.2.1/configure.ac.orig nfs-utils-2.2.1/configure.ac
--- nfs-utils-2.2.1/configure.ac.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/configure.ac 2017-10-25 15:52:43.287511759 -0400
@@ -552,6 +552,11 @@ AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
# Make sure that $ACLOCAL_FLAGS are used during a rebuild
AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
+# make libexecdir available for substituion in config files
+# 2 "evals" needed late to expand variable names.
+AC_SUBST([_libexecdir])
+AC_CONFIG_COMMANDS_PRE([eval eval _libexecdir=$libexecdir])
+
# make _sysconfdir available for substituion in config files
# 2 "evals" needed late to expand variable names.
AC_SUBST([_sysconfdir])
@@ -559,6 +564,7 @@ AC_CONFIG_COMMANDS_PRE([eval eval _sysco
AC_CONFIG_FILES([
Makefile
+ systemd/nfs-config.service
systemd/rpc-gssd.service
linux-nfs/Makefile
support/Makefile
diff -up nfs-utils-2.2.1/systemd/Makefile.am.orig nfs-utils-2.2.1/systemd/Makefile.am
--- nfs-utils-2.2.1/systemd/Makefile.am.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/Makefile.am 2017-10-25 15:52:43.287511759 -0400
@@ -6,6 +6,7 @@ unit_files = \
nfs-client.target \
rpc_pipefs.target \
\
+ nfs-config.service \
nfs-mountd.service \
nfs-server.service \
nfs-utils.service \
diff -up nfs-utils-2.2.1/systemd/nfs-blkmap.service.orig nfs-utils-2.2.1/systemd/nfs-blkmap.service
--- nfs-utils-2.2.1/systemd/nfs-blkmap.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-blkmap.service 2017-10-25 15:52:43.288511762 -0400
@@ -10,7 +10,8 @@ PartOf=nfs-utils.service
[Service]
Type=forking
PIDFile=/var/run/blkmapd.pid
-ExecStart=/usr/sbin/blkmapd
+EnvironmentFile=-/run/sysconfig/nfs-utils
+ExecStart=/usr/sbin/blkmapd $BLKMAPDARGS
[Install]
WantedBy=nfs-client.target
diff -up nfs-utils-2.2.1/systemd/nfs-config.service.in.orig nfs-utils-2.2.1/systemd/nfs-config.service.in
--- nfs-utils-2.2.1/systemd/nfs-config.service.in.orig 2017-10-25 15:52:43.288511762 -0400
+++ nfs-utils-2.2.1/systemd/nfs-config.service.in 2017-10-25 15:52:43.288511762 -0400
@@ -0,0 +1,13 @@
+[Unit]
+Description=Preprocess NFS configuration
+After=local-fs.target
+DefaultDependencies=no
+
+[Service]
+Type=oneshot
+# This service needs to run any time any nfs service
+# is started, so changes to local config files get
+# incorporated. Having "RemainAfterExit=no" (the default)
+# ensures this happens.
+RemainAfterExit=no
+ExecStart=@_libexecdir@/nfs-utils/nfs-utils_env.sh
diff -up nfs-utils-2.2.1/systemd/nfs-idmapd.service.orig nfs-utils-2.2.1/systemd/nfs-idmapd.service
--- nfs-utils-2.2.1/systemd/nfs-idmapd.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-idmapd.service 2017-10-25 15:52:43.288511762 -0400
@@ -6,6 +6,10 @@ After=rpc_pipefs.target local-fs.target
BindsTo=nfs-server.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=/usr/sbin/rpc.idmapd
+ExecStart=/usr/sbin/rpc.idmapd $RPCIDMAPDARGS
diff -up nfs-utils-2.2.1/systemd/nfs-mountd.service.orig nfs-utils-2.2.1/systemd/nfs-mountd.service
--- nfs-utils-2.2.1/systemd/nfs-mountd.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-mountd.service 2017-10-25 15:52:43.289511766 -0400
@@ -8,6 +8,10 @@ After=network-online.target local-fs.tar
After=rpcbind.socket
BindsTo=nfs-server.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
-ExecStart=/usr/sbin/rpc.mountd
+ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDARGS
diff -up nfs-utils-2.2.1/systemd/nfs-server.service.orig nfs-utils-2.2.1/systemd/nfs-server.service
--- nfs-utils-2.2.1/systemd/nfs-server.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/nfs-server.service 2017-10-25 15:52:43.289511766 -0400
@@ -16,11 +16,16 @@ Before= rpc-statd-notify.service
Wants=auth-rpcgss-module.service
After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/sbin/exportfs -r
-ExecStart=/usr/sbin/rpc.nfsd
+ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f
diff -up nfs-utils-2.2.1/systemd/README.orig nfs-utils-2.2.1/systemd/README
--- nfs-utils-2.2.1/systemd/README.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/README 2017-10-25 15:52:43.289511766 -0400
@@ -19,8 +19,8 @@ by a suitable 'preset' setting:
can work (if no type is given, ".service" is assumed).
nfs-client.target
- If enabled, daemons needed for an nfs client are enabled.
- This does *not* include rpc.statd. The rpc-statd.service unit
+ If enabled, daemons needs for an nfs client are enabled.
+ This does *not* include rpc.statd. the rpc-statd.service unit
is started by /usr/sbin/start-statd which mount.nfs will run
if statd is needed.
@@ -52,19 +52,11 @@ It cannot stop rpc.statd or rpc.gssd as
client and systemd cannot specify is two-pronged reverse dependency.
(i.e. stop this unit if none of these units are running)
-Distro specific configuration can be included in /etc/nfs.conf, or
-by providing drop-in files which replace the ExecStart line for a given
-service, and possibly add an EnvironmentFile line.
-
-For example, if systemd/system/nfs-mountd.service.d/local.conf
-contained
- [Service]
- EnvironmentFile=/etc/sysconfig/nfs
- ExecStart=
- ExecStart=/usr/sbin/rpc.mountd $RPCMOUNTDOPTS
-
-then the setting of RPCMOUNTDOPTS in /etc/sysconfig/nfs would be
-passed to rpc.mountd.
+Distro specific commandline configuration can be provided by
+installing a script /usr/libexec/nfs-utils/nfs-utils_env.sh
+This should write /run/sysconfig/nfs-utils based on configuration
+information such as in /etc/sysconfig/nfs or /etc/defaults/nfs.
+It is run once by nfs-config.service.
rpc.gssd and rpc.svcgssd are assumed to be needed if /etc/krb5.keytab
is present.
diff -up nfs-utils-2.2.1/systemd/rpc-gssd.service.in.orig nfs-utils-2.2.1/systemd/rpc-gssd.service.in
--- nfs-utils-2.2.1/systemd/rpc-gssd.service.in.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/rpc-gssd.service.in 2017-10-25 15:52:43.290511769 -0400
@@ -9,6 +9,11 @@ ConditionPathExists=@_sysconfdir@/krb5.k
PartOf=nfs-utils.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
+EnvironmentFile=-/run/sysconfig/nfs-utils
+
Type=forking
-ExecStart=/usr/sbin/rpc.gssd
+ExecStart=/usr/sbin/rpc.gssd $RPCGSSDARGS
diff -up nfs-utils-2.2.1/systemd/rpc-statd-notify.service.orig nfs-utils-2.2.1/systemd/rpc-statd-notify.service
--- nfs-utils-2.2.1/systemd/rpc-statd-notify.service.orig 2017-10-25 15:52:43.290511769 -0400
+++ nfs-utils-2.2.1/systemd/rpc-statd-notify.service 2017-10-25 15:56:28.102284921 -0400
@@ -10,7 +10,11 @@ After=nfs-server.service
PartOf=nfs-utils.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
Type=forking
-ExecStart=-/usr/sbin/sm-notify
+EnvironmentFile=-/run/sysconfig/nfs-utils
+ExecStart=-/usr/sbin/sm-notify $SMNOTIFYARGS
RemainAfterExit=yes
diff -up nfs-utils-2.2.1/systemd/rpc-statd.service.orig nfs-utils-2.2.1/systemd/rpc-statd.service
--- nfs-utils-2.2.1/systemd/rpc-statd.service.orig 2017-10-25 15:32:19.000000000 -0400
+++ nfs-utils-2.2.1/systemd/rpc-statd.service 2017-10-25 15:52:43.291511772 -0400
@@ -8,8 +8,12 @@ After=network-online.target nss-lookup.t
PartOf=nfs-utils.service
+Wants=nfs-config.service
+After=nfs-config.service
+
[Service]
Environment=RPC_STATD_NO_NOTIFY=1
+EnvironmentFile=-/run/sysconfig/nfs-utils
Type=forking
PIDFile=/var/run/rpc.statd.pid
-ExecStart=/usr/sbin/rpc.statd
+ExecStart=/usr/sbin/rpc.statd $STATDARGS

View File

@ -1,11 +0,0 @@
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 $RPCNFSDARGS
+ExecStart=-/bin/sh -c 'if systemctl -q is-active gssproxy; then systemctl restart gssproxy ; fi'
ExecStop=/usr/sbin/rpc.nfsd 0
ExecStopPost=/usr/sbin/exportfs -au
ExecStopPost=/usr/sbin/exportfs -f

View File

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

View File

@ -1,49 +0,0 @@
From 98a07fa29244369dec8b03bac7b1a64a0b3aa7fc Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Fri, 15 Mar 2019 17:03:10 +0800
Subject: [PATCH] backport bugfix fail disable major NFS version 4
---
nfs-utils-2.3.3/utils/nfsd/nfsd.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git nfs-utils-2.3.3/utils/nfsd/nfsd.c nfs-utils-2.3.3/utils/nfsd/nfsd.c
index 6b57e2b..b256bd9 100644
--- nfs-utils-2.3.3/utils/nfsd/nfsd.c
+++ nfs-utils-2.3.3/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.
*/
--
1.8.3.1

View File

@ -1,62 +0,0 @@
From 62796bf26e196da724f86bcbc327f5f9f999d305 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 14:53:30 +0800
Subject: [PATCH] backport ignore EBUSY when a filesystem is already mount
---
utils/mount/Makefile.am | 1 +
utils/mount/stropts.c | 17 +++++++++++------
2 files changed, 12 insertions(+), 6 deletions(-)
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..5333498 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;
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From d641d84b33b268af6a0f5954c1399608e9fde692 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 14:55:46 +0800
Subject: [PATCH] backport fix quoting in configure.ac
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 23ad9c7..87067f0 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"])
--
1.8.3.1

View File

@ -1,54 +0,0 @@
From c02dd63e790a26f2f6f108aaa18556bc344aed0f Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 15:03:48 +0800
Subject: [PATCH] backport harden configure ac checks for libxml2
---
aclocal/libxml2.m4 | 20 +++++++++++---------
support/junction/Makefile.am | 2 --
2 files changed, 11 insertions(+), 11 deletions(-)
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/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
--
1.8.3.1

View File

@ -1,115 +0,0 @@
From ff4668dc7465d3c7bbe36e733206465968bcc2b2 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 15:20:16 +0800
Subject: [PATCH] backport finish port of junction support to nfs-utils
---
configure.ac | 8 +++++++-
utils/mountd/cache.c | 18 +++++++++---------
utils/nfsref/Makefile.am | 2 --
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac
index 87067f0..228fe7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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/utils/mountd/cache.c b/utils/mountd/cache.c
index 6f42512..21aa4d2 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..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
--
1.8.3.1

View File

@ -1,43 +0,0 @@
From 063638118e5b53dbb21270e1b2860927fcd61e6a Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 15:26:14 +0800
Subject: [PATCH] backport add IgnoreOnIsolate=yes in rpc-statd.service
---
systemd/rpc-statd.service | 1 +
utils/statd/start-statd | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service
index 1ed60a8..7cd78ec 100644
--- a/systemd/rpc-statd.service
+++ b/systemd/rpc-statd.service
@@ -7,6 +7,7 @@ Wants=network-online.target
After=network-online.target nss-lookup.target rpcbind.socket
PartOf=nfs-utils.service
+IgnoreOnIsolate=yes
Wants=nfs-config.service
After=nfs-config.service
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 /
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 421e1a4c580ddf4d8f7e5f1453b395367d24ad09 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 15:36:08 +0800
Subject: [PATCH] backport improve error msg when mount fail with EBUSY
---
utils/mount/error.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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:
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 33a3664897549751fe37280d3d110bff66f7b2e7 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 16:19:05 +0800
Subject: [PATCH] backport fix --with-rpcgen=internal nottaking effect
---
configure.ac | 2 ++
1 file changed, 2 insertions(+)
diff --git a/configure.ac b/configure.ac
index 228fe7f..49b1e8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -155,6 +155,8 @@ AC_ARG_WITH(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
fi
AC_SUBST(RPCGEN_PATH)
AM_CONDITIONAL(CONFIG_RPCGEN, [test "$RPCGEN_PATH" = "internal"])
--
1.8.3.1

View File

@ -1,41 +0,0 @@
From 121e7132c7bd4c93dcdf1087039c3ec203947432 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 16:23:22 +0800
Subject: [PATCH] backport do not fatalize -Wstrict-prototypes with internal
rpcgen
---
configure.ac | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 49b1e8d..3de0ed4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,12 +149,14 @@ 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
+ rpcgen_cflags=-Wstrict-prototypes
else
RPCGEN_PATH=internal
fi
@@ -548,7 +550,7 @@ my_am_cflags="\
-pipe \
-Wall \
-Wextra \
- -Werror=strict-prototypes \
+ $rpcgen_cflags \
-Werror=missing-prototypes \
-Werror=missing-declarations \
-Werror=format=2 \
--
1.8.3.1

View File

@ -1,28 +0,0 @@
From 8e8f8d57ccb970ebdd09896345b100d64528b546 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 16:28:36 +0800
Subject: [PATCH] =?UTF-8?q?backport=20run=20statd-notify=20even=20when=20n?=
=?UTF-8?q?fs-client=20isn=E2=80=98t=20enabled?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
systemd/rpc-statd.service | 1 +
1 file changed, 1 insertion(+)
diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service
index 7cd78ec..888bd5d 100644
--- a/systemd/rpc-statd.service
+++ b/systemd/rpc-statd.service
@@ -4,6 +4,7 @@ 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
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From e65245488a46e000c38d2b926b66f6157c1c5a70 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 16:32:32 +0800
Subject: [PATCH] backport honour --with-pluginpath for instalation
---
configure.ac | 1 +
support/nfsidmap/Makefile.am | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 3de0ed4..06122ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -450,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,
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
--
1.8.3.1

View File

@ -1,39 +0,0 @@
From 3ca32fdf9dae0f2ca10fe46c2cf7e0be75425abc Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 16:42:21 +0800
Subject: [PATCH] backport update the path of libnfs.a
---
tests/Makefile.am | 2 +-
tests/nsm_client/Makefile.am | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1f96264..74aa629 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -3,7 +3,7 @@
check_PROGRAMS = statdb_dump
statdb_dump_SOURCES = statdb_dump.c
-statdb_dump_LDADD = ../support/nfs/libnfs.a \
+statdb_dump_LDADD = ../support/nfs/.libs/libnfs.a \
../support/nsm/libnsm.a $(LIBCAP)
SUBDIRS = nsm_client
diff --git a/tests/nsm_client/Makefile.am b/tests/nsm_client/Makefile.am
index a8fc131..43db9c2 100644
--- a/tests/nsm_client/Makefile.am
+++ b/tests/nsm_client/Makefile.am
@@ -13,7 +13,7 @@ check_PROGRAMS = nsm_client
nsm_client_SOURCES = $(GENFILES) nsm_client.c
BUILT_SOURCES = $(GENFILES)
-nsm_client_LDADD = ../../support/nfs/libnfs.a \
+nsm_client_LDADD = ../../support/nfs/.libs/libnfs.a \
../../support/nsm/libnsm.a $(LIBCAP) $(LIBTIRPC)
if CONFIG_RPCGEN
--
1.8.3.1

View File

@ -1,42 +0,0 @@
From cd373e4a960b4a0e4fc4cec1bd64ecaefbe6e1dc Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 16:48:03 +0800
Subject: [PATCH] backport removed new error=format-overflow=2 errors in
nfs-utils
---
utils/blkmapd/device-discovery.c | 2 +-
utils/mount/error.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index 3a202e0..2ce60f8 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -239,7 +239,7 @@ int bl_discover_devices(void)
{
FILE *f;
int n;
- char buf[PATH_MAX], devname[PATH_MAX], fulldevname[PATH_MAX+NAME_MAX];
+ char buf[PATH_MAX], devname[NAME_MAX], fulldevname[PATH_MAX];
/* release previous list */
bl_release_disk();
diff --git a/utils/mount/error.c b/utils/mount/error.c
index dfe5c7d..562f312 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -50,8 +50,8 @@
extern char *progname;
-static char errbuf[BUFSIZ];
-static char *erreob = &errbuf[BUFSIZ];
+static char errbuf[PATH_MAX];
+static char *erreob = &errbuf[PATH_MAX];
/* Convert RPC errors into strings */
static int rpc_strerror(int spos)
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From a966249d50bed2fc81f9aa130bc4892a94d95a00 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 16:50:55 +0800
Subject: [PATCH] backport fixed manage-gids option typo in nfs.conf
---
nfs.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nfs.conf b/nfs.conf
index 0d0ec9b..2cc0950 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -25,7 +25,7 @@
#
#[mountd]
# debug=0
-# manage_gids=n
+# manage-gids=n
# descriptors=0
# port=0
# threads=1
--
1.8.3.1

View File

@ -1,27 +0,0 @@
From e7ddbe72a6d55d8a9811d9a71b2a614752faf6da Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 17:09:31 +0800
Subject: [PATCH] backport more carefully detect availability of
res_querydomain
---
configure.ac | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 06122ad..324ccea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -411,7 +411,8 @@ if test "$enable_gss" = yes; then
fi
dnl libdnsidmap specific checks
-AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain needed))
+AC_CHECK_LIB([resolv], [__res_querydomain], ,
+ AC_CHECK_LIB([resolv], [res_querydomain], , AC_MSG_ERROR(res_querydomain needed)))
AC_ARG_ENABLE([ldap],
[AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:default=detect@:>@])])
--
1.8.3.1

View File

@ -1,26 +0,0 @@
From b7c8b041a6533f4733e7ab3e5d187f2a696b17bc Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 17:11:54 +0800
Subject: [PATCH] backport fix use of undefined macro HAVE_GETRPCBYNUMBER_R in
svc_socket
---
support/nfs/svc_socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/support/nfs/svc_socket.c b/support/nfs/svc_socket.c
index 1239712..d56507a 100644
--- a/support/nfs/svc_socket.c
+++ b/support/nfs/svc_socket.c
@@ -46,7 +46,7 @@ int getservport(u_long number, const char *proto)
struct rpcent *rpcp;
struct servent servbuf, *servp = NULL;
int ret = 0;
-#if HAVE_GETRPCBYNUMBER_R
+#ifdef HAVE_GETRPCBYNUMBER_R
char rpcdata[1024];
struct rpcent rpcbuf;
--
1.8.3.1

View File

@ -1,40 +0,0 @@
From 2a9500003c745ce3305a38af77086572d37729ba Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Sat, 16 Mar 2019 17:21:23 +0800
Subject: [PATCH] backport provide the UID/GID/name for which mapping fails
---
utils/nfsidmap/nfsidmap.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/utils/nfsidmap/nfsidmap.c b/utils/nfsidmap/nfsidmap.c
index 1359302..b3485ea 100644
--- a/utils/nfsidmap/nfsidmap.c
+++ b/utils/nfsidmap/nfsidmap.c
@@ -205,8 +205,9 @@ static int id_lookup(char *name_at_domain, key_serial_t key, int type)
sprintf(id, "%u", gid);
}
if (rc < 0) {
- xlog_errno(rc, "id_lookup: %s: failed: %m",
- (type == USER ? "nfs4_owner_to_uid" : "nfs4_group_owner_to_gid"));
+ xlog_errno(rc, "id_lookup: %s: for %s failed: %m",
+ (type == USER ? "nfs4_owner_to_uid" : "nfs4_group_owner_to_gid"),
+ name_at_domain);
return EXIT_FAILURE;
}
@@ -262,8 +263,9 @@ static int name_lookup(char *id, key_serial_t key, int type)
rc = nfs4_gid_to_name(gid, domain, name, IDMAP_NAMESZ);
}
if (rc) {
- xlog_errno(rc, "name_lookup: %s: failed: %m",
- (type == USER ? "nfs4_uid_to_name" : "nfs4_gid_to_name"));
+ xlog_errno(rc, "name_lookup: %s: for %u failed: %m",
+ (type == USER ? "nfs4_uid_to_name" : "nfs4_gid_to_name"),
+ (type == USER ? uid : gid));
return EXIT_FAILURE;
}
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 7f00a3282be1af0d9007dfc526c7a74116066528 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 11:38:26 +0800
Subject: [PATCH] backport add miss cast to getsockname
---
utils/mount/network.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/mount/network.c b/utils/mount/network.c
index 356f663..4d0d789 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1062,7 +1062,7 @@ int clnt_ping(struct sockaddr_in *saddr, const unsigned long prog,
if (caddr) {
/* Get the address of our end of this connection */
socklen_t len = sizeof(*caddr);
- if (getsockname(sock, caddr, &len) != 0)
+ if (getsockname(sock, (struct sockaddr *) caddr, &len) != 0)
caddr->sin_family = 0;
}
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From d293502df145d723215e9d306221df99799777f4 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 11:42:07 +0800
Subject: [PATCH] backport add miss libgen header in idmapd
---
utils/idmapd/idmapd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
index 4811e0f..1958c90 100644
--- a/utils/idmapd/idmapd.c
+++ b/utils/idmapd/idmapd.c
@@ -59,6 +59,7 @@
#include <grp.h>
#include <limits.h>
#include <ctype.h>
+#include <libgen.h>
#include <nfsidmap.h>
#ifdef HAVE_CONFIG_H
--
1.8.3.1

View File

@ -1,42 +0,0 @@
From 2291784782340796e5c66dcf4f95f75b48a9956d Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 11:48:35 +0800
Subject: [PATCH] backport remove resource leaks from junction/path.c
---
support/junction/path.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/support/junction/path.c b/support/junction/path.c
index e74e4c4..13a1438 100644
--- a/support/junction/path.c
+++ b/support/junction/path.c
@@ -163,8 +163,10 @@ nsdb_count_components(const char *pathname, size_t *len,
break;
next = strchrnul(component, '/');
tmp = (size_t)(next - component);
- if (tmp > 255)
+ if (tmp > 255) {
+ free(start);
return false;
+ }
length += XDR_UINT_BYTES + (nsdb_quadlen(tmp) << 2);
count++;
@@ -328,11 +330,13 @@ nsdb_posix_to_path_array(const char *pathname, char ***path_array)
length = (size_t)(next - component);
if (length > 255) {
nsdb_free_string_array(result);
+ free(normalized);
return FEDFS_ERR_SVRFAULT;
}
result[i] = strndup(component, length);
if (result[i] == NULL) {
+ free(normalized);
nsdb_free_string_array(result);
return FEDFS_ERR_SVRFAULT;
}
--
1.8.3.1

View File

@ -1,32 +0,0 @@
From 7906c0c91de63bc795a52f75b62389f68297c3f3 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 11:54:45 +0800
Subject: [PATCH] backport remove resource leaks from nfs/exports.c
---
support/nfs/exports.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index c0076a8..d826ba0 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -714,6 +714,7 @@ parsesquash(char *list, int **idp, int *lenp, char **ep)
}
if (id0 == -1 || id1 == -1) {
syntaxerr("uid/gid -1 not permitted");
+ xfree(id);
return -1;
}
if ((len % 8) == 0)
@@ -724,6 +725,7 @@ parsesquash(char *list, int **idp, int *lenp, char **ep)
break;
if (*cp != ',') {
syntaxerr("bad uid/gid list");
+ xfree(id);
return -1;
}
cp++;
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From 46a65cdd5beaaca05ccbe65279e667727306e429 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 11:57:26 +0800
Subject: [PATCH] backport remove resource leak from nfs/mydaemon.c
---
support/nfs/mydaemon.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/nfs/mydaemon.c b/support/nfs/mydaemon.c
index 343e80b..d1cf08d 100644
--- a/support/nfs/mydaemon.c
+++ b/support/nfs/mydaemon.c
@@ -123,6 +123,7 @@ daemon_init(bool fg)
dup2(tempfd, 0);
dup2(tempfd, 1);
dup2(tempfd, 2);
+ close(tempfd);
closelog();
dup2(pipefds[1], 3);
pipefds[1] = 3;
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From db469aeb63fe471b397b26b61db15593d284078b Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 12:05:33 +0800
Subject: [PATCH] backport remove resource leak from nfs/rpcmisc.c
---
support/nfs/rpcmisc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/nfs/rpcmisc.c b/support/nfs/rpcmisc.c
index abe89ba..d84c04f 100644
--- a/support/nfs/rpcmisc.c
+++ b/support/nfs/rpcmisc.c
@@ -102,6 +102,7 @@ makesock(int port, int proto)
if (bind(sock, (struct sockaddr *) &sin, sizeof(sin)) == -1) {
xlog(L_FATAL, "Could not bind name to socket: %s",
strerror(errno));
+ close(sock);
return -1;
}
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From 4f9d2bf8a677a61a105703319e9f7985d20f6f02 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 12:10:41 +0800
Subject: [PATCH] backport remove resource leak from nfs/svc_socket.c
---
support/nfs/svc_socket.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/nfs/svc_socket.c b/support/nfs/svc_socket.c
index d56507a..c711b39 100644
--- a/support/nfs/svc_socket.c
+++ b/support/nfs/svc_socket.c
@@ -134,6 +134,7 @@ svc_socket (u_long number, int type, int protocol, int reuse)
if (ret < 0)
{
xlog(L_ERROR, "svc_socket: socket reuse problem: %m");
+ (void) __close(sock);
return ret;
}
}
--
1.8.3.1

View File

@ -1,57 +0,0 @@
From e0af6c60072391fe736ec2b1cdb0064af7eaddb7 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 12:21:00 +0800
Subject: [PATCH] backport remove bad frees from nfs/xcommon.c
---
support/nfs/xcommon.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c
index 14e580e..3989f0b 100644
--- a/support/nfs/xcommon.c
+++ b/support/nfs/xcommon.c
@@ -53,14 +53,17 @@ char *
xstrconcat3 (const char *s, const char *t, const char *u) {
char *res;
- if (!s) s = "";
+ int dofree = 1;
+
+ if (!s) s = "", dofree=0;
if (!t) t = "";
if (!u) u = "";
res = xmalloc(strlen(s) + strlen(t) + strlen(u) + 1);
strcpy(res, s);
strcat(res, t);
strcat(res, u);
- free((void *) s);
+ if (dofree)
+ free((void *) s);
return res;
}
@@ -69,7 +72,9 @@ char *
xstrconcat4 (const char *s, const char *t, const char *u, const char *v) {
char *res;
- if (!s) s = "";
+ int dofree = 1;
+
+ if (!s) s = "", dofree=0;
if (!t) t = "";
if (!u) u = "";
if (!v) v = "";
@@ -78,7 +83,8 @@ xstrconcat4 (const char *s, const char *t, const char *u, const char *v) {
strcat(res, t);
strcat(res, u);
strcat(res, v);
- free((void *) s);
+ if (dofree)
+ free((void *) s);
return res;
}
--
1.8.3.1

View File

@ -1,32 +0,0 @@
From a4da9694c5e961e5dde1a0ad311177a9478903ff Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 12:29:36 +0800
Subject: [PATCH] backport remove resource leaks from nfs/xlog.c
---
support/nfs/xlog.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c
index f75a9ab..687d862 100644
--- a/support/nfs/xlog.c
+++ b/support/nfs/xlog.c
@@ -135,10 +135,14 @@ xlog_from_conffile(char *service)
struct conf_list_node *n;
kinds = conf_get_list(service, "debug");
- if (!kinds || !kinds->cnt)
+ if (!kinds || !kinds->cnt) {
+ free(kinds);
return;
+ }
TAILQ_FOREACH(n, &(kinds->fields), link)
xlog_sconfig(n->field, 1);
+
+ conf_free_list(kinds);
}
int
--
1.8.3.1

View File

@ -1,45 +0,0 @@
From 1e6384ff431b3e3cc2dfeede2deb6a8aba154d13 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 14:45:24 +0800
Subject: [PATCH] backport remove resource leaks from nfsidmap/libnfsidmap.c
---
support/nfsidmap/libnfsidmap.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index 35ddf01..7b8a871 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -406,8 +406,10 @@ int nfs4_init_name_mapping(char *conffile)
nfs4_methods = conf_get_list("Translation", "Method");
if (nfs4_methods) {
IDMAP_LOG(1, ("libnfsidmap: processing 'Method' list"));
- if (load_plugins(nfs4_methods, &nfs4_plugins) == -1)
+ if (load_plugins(nfs4_methods, &nfs4_plugins) == -1) {
+ conf_free_list(nfs4_methods);
return -ENOENT;
+ }
} else {
struct conf_list list;
struct conf_list_node node;
@@ -475,11 +477,15 @@ out:
if (ret) {
if (nfs4_plugins)
unload_plugins(nfs4_plugins);
- if (gss_plugins)
+ if (gss_plugins) {
unload_plugins(gss_plugins);
+ }
nfs4_plugins = gss_plugins = NULL;
}
+ if (gss_methods)
+ conf_free_list(gss_methods);
+
return ret ? -ENOENT: 0;
}
--
1.8.3.1

View File

@ -1,61 +0,0 @@
From 079dad655fad6e2a77810c9e4f7b491c77b0b46e Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 14:51:08 +0800
Subject: [PATCH] backport remove resource leaks from nfsidmap/static.c
---
support/nfsidmap/static.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/support/nfsidmap/static.c b/support/nfsidmap/static.c
index f7b8a67..f97c556 100644
--- a/support/nfsidmap/static.c
+++ b/support/nfsidmap/static.c
@@ -347,6 +347,7 @@ static int static_init(void) {
warnx("static_init: calloc (1, %lu) failed",
(unsigned long)sizeof *unode);
free(pw);
+ conf_free_list(princ_list);
return -ENOMEM;
}
unode->uid = pw->pw_uid;
@@ -355,6 +356,9 @@ static int static_init(void) {
unode->localname = conf_get_str("Static", cln->field);
if (!unode->localname) {
free(pw);
+ free(unode->principal);
+ free(unode);
+ conf_free_list(princ_list);
return -ENOENT;
}
@@ -379,6 +383,7 @@ static int static_init(void) {
warnx("static_init: calloc (1, %lu) failed",
(unsigned long)sizeof *gnode);
free(gr);
+ conf_free_list(princ_list);
return -ENOMEM;
}
gnode->gid = gr->gr_gid;
@@ -387,6 +392,9 @@ static int static_init(void) {
gnode->localgroup = conf_get_str("Static", cln->field);
if (!gnode->localgroup) {
free(gr);
+ free(gnode->principal);
+ free(gnode);
+ conf_free_list(princ_list);
return -ENOENT;
}
@@ -394,6 +402,8 @@ static int static_init(void) {
LIST_INSERT_HEAD (&gid_mappings[gid_hash(gnode->gid)], gnode, link);
}
+
+ conf_free_list(princ_list);
return 0;
}
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From 189401bfd773ee8bc8170272000f4ed8b532a2f3 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 15:00:27 +0800
Subject: [PATCH] backport remove a resource leak from nsm/file.c
---
support/nsm/file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/support/nsm/file.c b/support/nsm/file.c
index 52f5401..0b66f12 100644
--- a/support/nsm/file.c
+++ b/support/nsm/file.c
@@ -533,6 +533,7 @@ nsm_update_kernel_state(const int state)
len = snprintf(buf, sizeof(buf), "%d", state);
if (error_check(len, sizeof(buf))) {
xlog_warn("Failed to form NSM state number string");
+ close(fd);
return;
}
--
1.8.3.1

View File

@ -1,51 +0,0 @@
From 2066abebb6fb5fdcad6f11334e75a3029374b912 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 15:04:45 +0800
Subject: [PATCH] backport remove resource leaks from rpc-pipefs-generator.c
---
systemd/rpc-pipefs-generator.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/systemd/rpc-pipefs-generator.c b/systemd/rpc-pipefs-generator.c
index 0b5da11..8e218aa 100644
--- a/systemd/rpc-pipefs-generator.c
+++ b/systemd/rpc-pipefs-generator.c
@@ -69,12 +69,16 @@ int generate_target(char *pipefs_path, const char *dirname)
return 1;
ret = generate_mount_unit(pipefs_path, pipefs_unit, dirname);
- if (ret)
+ if (ret) {
+ free(pipefs_unit);
return ret;
+ }
path = malloc(strlen(dirname) + 1 + sizeof(filebase));
- if (!path)
+ if (!path) {
+ free(pipefs_unit);
return 2;
+ }
sprintf(path, "%s", dirname);
mkdir(path, 0755);
strcat(path, filebase);
@@ -82,6 +86,7 @@ int generate_target(char *pipefs_path, const char *dirname)
if (!f)
{
free(path);
+ free(pipefs_unit);
return 1;
}
@@ -90,6 +95,7 @@ int generate_target(char *pipefs_path, const char *dirname)
fprintf(f, "After=%s\n", pipefs_unit);
fclose(f);
free(path);
+ free(pipefs_unit);
return 0;
}
--
1.8.3.1

View File

@ -1,75 +0,0 @@
From ac728c989e6c1e107f332ccdcd38d6e4271cffc3 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 15:16:19 +0800
Subject: [PATCH] backport remove resource leaks from device-discovery.c
---
utils/blkmapd/device-discovery.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index 2ce60f8..e811703 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -186,8 +186,13 @@ static void bl_add_disk(char *filepath)
}
}
- if (disk && diskpath)
+ if (disk && diskpath) {
+ if (serial) {
+ free(serial->data);
+ free(serial);
+ }
return;
+ }
/* add path */
path = malloc(sizeof(struct bl_disk_path));
@@ -223,6 +228,10 @@ static void bl_add_disk(char *filepath)
disk->size = size;
disk->valid_path = path;
}
+ if (serial) {
+ free(serial->data);
+ free(serial);
+ }
}
return;
@@ -232,6 +241,10 @@ static void bl_add_disk(char *filepath)
free(path->full_path);
free(path);
}
+ if (serial) {
+ free(serial->data);
+ free(serial);
+ }
return;
}
@@ -375,7 +388,12 @@ static void bl_rpcpipe_cb(void)
if (event->mask & IN_CREATE) {
BL_LOG_WARNING("nfs pipe dir created\n");
bl_watch_dir(nfspipe_dir, &nfs_pipedir_wfd);
+ if (bl_pipe_fd >= 0)
+ close(bl_pipe_fd);
bl_pipe_fd = open(bl_pipe_file, O_RDWR);
+ if (bl_pipe_fd < 0)
+ BL_LOG_ERR("open %s failed: %s\n",
+ event->name, strerror(errno));
} else if (event->mask & IN_DELETE) {
BL_LOG_WARNING("nfs pipe dir deleted\n");
inotify_rm_watch(bl_watch_fd, nfs_pipedir_wfd);
@@ -388,6 +406,8 @@ static void bl_rpcpipe_cb(void)
continue;
if (event->mask & IN_CREATE) {
BL_LOG_WARNING("blocklayout pipe file created\n");
+ if (bl_pipe_fd >= 0)
+ close(bl_pipe_fd);
bl_pipe_fd = open(bl_pipe_file, O_RDWR);
if (bl_pipe_fd < 0)
BL_LOG_ERR("open %s failed: %s\n",
--
1.8.3.1

View File

@ -1,53 +0,0 @@
From a215c0ac5c2cc8c1686349aeafaf110853aa8457 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 15:48:48 +0800
Subject: [PATCH] backport remove resource leaks from krb5_util.c
---
utils/gssd/krb5_util.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index eba1aac..c84c2a2 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -698,6 +698,8 @@ 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);
+ k5err = NULL;
continue;
}
printerr(4, "Processing keytab entry for principal '%s'\n",
@@ -899,6 +901,8 @@ 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);
+ k5err = NULL;
continue;
}
code = krb5_kt_get_entry(context, kt, princ, 0, 0, kte);
@@ -1168,7 +1172,8 @@ gssd_get_krb5_machine_cred_list(char ***list)
*list = l;
retval = 0;
goto out;
- }
+ } else
+ free((void *)l);
out:
return retval;
}
@@ -1216,6 +1221,8 @@ gssd_destroy_krb5_machine_creds(void)
printerr(0, "WARNING: %s while resolving credential "
"cache '%s' for destruction\n", k5err,
ple->ccname);
+ free(k5err);
+ k5err = NULL;
continue;
}
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From 0e668a2e09556150c8f963817f1e5dfb99f01f6f Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 15:52:02 +0800
Subject: [PATCH] backport remove a resource leak from mount/configfile.c
---
utils/mount/configfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index b48b25e..93fe500 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -404,7 +404,7 @@ char *conf_get_mntopts(char *spec, char *mount_point,
/* list_size + optlen + ',' + '\0' */
config_opts = calloc(1, (list_size+optlen+2));
- if (server == NULL) {
+ if (config_opts == NULL) {
xlog_warn("conf_get_mountops: Unable calloc memory for config_opts");
free_all();
return mount_opts;
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From c8a963eee8eeb7bd8aeec850121cb015f64d52ab Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 15:54:11 +0800
Subject: [PATCH] backport remove a resource leak from mount/nfsmount.c
---
utils/mount/nfsmount.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c
index 952a755..3d95da9 100644
--- a/utils/mount/nfsmount.c
+++ b/utils/mount/nfsmount.c
@@ -452,6 +452,7 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
nfs_error(_("%s: Bad nfs mount parameter: %s\n"), progname, opt);
out_bad:
free(tmp_opts);
+ free(mounthost);
return 0;
}
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From db710094502306fc61457c7bc19e95bb28767496 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 15:56:40 +0800
Subject: [PATCH] backport remove a resource leak from mount/stropts.c
---
utils/mount/stropts.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 5333498..b4826a2 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -982,8 +982,11 @@ static int nfs_try_mount(struct nfsmount_info *mi)
}
if (!nfs_append_addr_option(address->ai_addr,
- address->ai_addrlen, mi->options))
+ address->ai_addrlen, mi->options)) {
+ freeaddrinfo(address);
+ errno = ENOMEM;
return 0;
+ }
mi->address = address;
}
--
1.8.3.1

View File

@ -1,38 +0,0 @@
From 74847efcc0899cd02c24aff5ba92c7859a7923ce Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 16:01:17 +0800
Subject: [PATCH] backport remove a resource leak from mountd/cache.c
---
utils/mountd/cache.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 7e8d403..a054ce6 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -1240,7 +1240,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
goto out;
}
status = nfs_get_basic_junction(pathname, &locations);
- switch (status) {
+ if (status) {
xlog(L_WARNING, "Dangling junction %s: %s",
pathname, strerror(status));
goto out;
@@ -1248,10 +1248,11 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
parent = lookup_parent_export(dom, pathname, ai);
if (parent == NULL)
- goto out;
+ goto free_locations;
exp = locations_to_export(locations, pathname, parent);
+free_locations:
nfs_free_locations(locations->ns_list);
free(locations);
--
1.8.3.1

View File

@ -1,24 +0,0 @@
From a4026bf99f666e3270049656088a810a9d510ff1 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 16:03:36 +0800
Subject: [PATCH] backport remove a resource leak from mountd/fsloc.c
---
utils/mountd/fsloc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/utils/mountd/fsloc.c b/utils/mountd/fsloc.c
index bc737d1..cf42944 100644
--- a/utils/mountd/fsloc.c
+++ b/utils/mountd/fsloc.c
@@ -102,6 +102,7 @@ static struct servers *parse_list(char **list)
cp = strchr(list[i], '@');
if ((!cp) || list[i][0] != '/') {
xlog(L_WARNING, "invalid entry '%s'", list[i]);
+ free(mp);
continue; /* XXX Need better error handling */
}
res->h_mp[i] = mp;
--
1.8.3.1

View File

@ -1,25 +0,0 @@
From c92497ac2458f63b2b751691d3903b4a4e968cfd Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 16:05:47 +0800
Subject: [PATCH] backport remove a resource leak from nfsdcltrack/sqlite.c
---
utils/nfsdcltrack/sqlite.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/utils/nfsdcltrack/sqlite.c b/utils/nfsdcltrack/sqlite.c
index c59f777..2801201 100644
--- a/utils/nfsdcltrack/sqlite.c
+++ b/utils/nfsdcltrack/sqlite.c
@@ -215,6 +215,8 @@ sqlite_maindb_init_v2(void)
&err);
if (ret != SQLITE_OK) {
xlog(L_ERROR, "Unable to begin transaction: %s", err);
+ if (err)
+ sqlite3_free(err);
return ret;
}
--
1.8.3.1

View File

@ -1,45 +0,0 @@
From 999e616fc825ffdc13c7cfeab3429284bcbe37c5 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 16:11:51 +0800
Subject: [PATCH] backport report correct error in the fall_back cases
---
utils/mount/stropts.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index b4826a2..f54bb61 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -888,7 +888,7 @@ out:
*/
static int nfs_autonegotiate(struct nfsmount_info *mi)
{
- int result;
+ int result, olderrno;
result = nfs_try_mount_v4(mi);
check_result:
@@ -948,7 +948,18 @@ fall_back:
if (mi->version.v_mode == V_GENERAL)
/* v2,3 fallback not allowed */
return result;
- return nfs_try_mount_v3v2(mi, FALSE);
+
+ /*
+ * Save the original errno in case the v3
+ * mount fails from one of the fall_back cases.
+ * Report the first failure not the v3 mount failure
+ */
+ olderrno = errno;
+ if ((result = nfs_try_mount_v3v2(mi, FALSE)))
+ return result;
+
+ errno = olderrno;
+ return result;
}
/*
--
1.8.3.1

View File

@ -1,71 +0,0 @@
From f5451d7a63e5cc303b2fc33eda387fba327b6c03 Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 16:21:44 +0800
Subject: [PATCH] backport fix e_hostname and e_uuid leaks in rpc.mountd
---
support/export/xtab.c | 16 ++++++++++++++++
support/nfs/exports.c | 12 +++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/support/export/xtab.c b/support/export/xtab.c
index d42eeef..38097e7 100644
--- a/support/export/xtab.c
+++ b/support/export/xtab.c
@@ -50,6 +50,14 @@ xtab_read(char *xtab, char *lockfn, int is_export)
while ((xp = getexportent(is_export==0, 0)) != NULL) {
if (!(exp = export_lookup(xp->e_hostname, xp->e_path, is_export != 1)) &&
!(exp = export_create(xp, is_export!=1))) {
+ if(xp->e_hostname) {
+ free(xp->e_hostname);
+ xp->e_hostname=NULL;
+ }
+ if(xp->e_uuid) {
+ free(xp->e_uuid);
+ xp->e_uuid=NULL;
+ }
continue;
}
switch (is_export) {
@@ -63,6 +71,14 @@ xtab_read(char *xtab, char *lockfn, int is_export)
v4root_needed = 0;
break;
}
+ if(xp->e_hostname) {
+ free(xp->e_hostname);
+ xp->e_hostname=NULL;
+ }
+ if(xp->e_uuid) {
+ free(xp->e_uuid);
+ xp->e_uuid=NULL;
+ }
}
endexportent();
xfunlock(lockid);
diff --git a/support/nfs/exports.c b/support/nfs/exports.c
index d826ba0..edb5d17 100644
--- a/support/nfs/exports.c
+++ b/support/nfs/exports.c
@@ -179,8 +179,18 @@ getexportent(int fromkernel, int fromexports)
}
ee.e_hostname = xstrdup(hostname);
- if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0)
+ if (parseopts(opt, &ee, fromexports && !has_default_subtree_opts, NULL) < 0) {
+ if(ee.e_hostname) {
+ xfree(ee.e_hostname);
+ ee.e_hostname=NULL;
+ }
+ if(ee.e_uuid) {
+ xfree(ee.e_uuid);
+ ee.e_uuid=NULL;
+ }
+
return NULL;
+ }
/* resolve symlinks */
if (realpath(ee.e_path, rpath) != NULL) {
--
1.8.3.1

View File

@ -1,36 +0,0 @@
From 5d3e2b483ec592dab84bdc12a2f4ef69c06e00eb Mon Sep 17 00:00:00 2001
From: huyan <hu.huyan@huawei.com>
Date: Mon, 17 Jun 2019 16:32:01 +0800
Subject: [PATCH] backport don't share cache file descriptors among processes
in mountd
---
utils/mountd/mountd.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 086c39b..becda27 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -836,8 +836,6 @@ main(int argc, char **argv)
if (!foreground)
closeall(3);
- cache_open();
-
unregister_services();
if (version2()) {
listeners += nfs_svc_create("mountd", MOUNTPROG,
@@ -888,6 +886,9 @@ main(int argc, char **argv)
if (num_threads > 1)
fork_workers();
+ /* Open files now to avoid sharing descriptors among forked processes */
+ cache_open();
+
xlog(L_NOTICE, "Version " VERSION " starting");
my_svc_run();
--
1.8.3.1

View File

@ -1,6 +1,18 @@
diff -up nfs-utils-2.1.1/utils/statd/sm-notify.man.orig nfs-utils-2.1.1/utils/statd/sm-notify.man From b4c60f47463d8cdd24a73e31b284a28efc8f2278 Mon Sep 17 00:00:00 2001
--- nfs-utils-2.1.1/utils/statd/sm-notify.man.orig 2017-04-26 12:45:14.205742654 -0400 From: openEuler Buildteam <buildteam@openeuler.org>
+++ nfs-utils-2.1.1/utils/statd/sm-notify.man 2017-04-26 12:45:44.042630801 -0400 Date: Fri, 10 Jan 2020 03:07:48 +0000
Subject: [PATCH] correct the statd path in man
Signed-off-by: hy-euler<eulerstoragemt@huawei.com>
---
utils/statd/sm-notify.man | 8 ++++----
utils/statd/statd.man | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/utils/statd/sm-notify.man b/utils/statd/sm-notify.man
index cfe1e4b..4658d86 100644
--- a/utils/statd/sm-notify.man
+++ b/utils/statd/sm-notify.man
@@ -184,7 +184,7 @@ where NSM state information resides. @@ -184,7 +184,7 @@ where NSM state information resides.
If this option is not specified, If this option is not specified,
.B sm-notify .B sm-notify
@ -10,7 +22,7 @@ diff -up nfs-utils-2.1.1/utils/statd/sm-notify.man.orig nfs-utils-2.1.1/utils/st
by default. by default.
.IP .IP
After starting, After starting,
@@ -330,13 +330,13 @@ Currently, the @@ -338,13 +338,13 @@ Currently, the
command supports sending notification only via datagram transport protocols. command supports sending notification only via datagram transport protocols.
.SH FILES .SH FILES
.TP 2.5i .TP 2.5i
@ -27,10 +39,11 @@ diff -up nfs-utils-2.1.1/utils/statd/sm-notify.man.orig nfs-utils-2.1.1/utils/st
NSM state number for this host NSM state number for this host
.TP 2.5i .TP 2.5i
.I /proc/sys/fs/nfs/nsm_local_state .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 diff --git a/utils/statd/statd.man b/utils/statd/statd.man
--- nfs-utils-2.1.1/utils/statd/statd.man.orig 2017-01-12 10:21:39.000000000 -0500 index 71d5846..ad81490 100644
+++ nfs-utils-2.1.1/utils/statd/statd.man 2017-04-26 12:45:44.043630798 -0400 --- a/utils/statd/statd.man
@@ -253,7 +253,7 @@ where NSM state information resides. +++ b/utils/statd/statd.man
@@ -251,7 +251,7 @@ where NSM state information resides.
If this option is not specified, If this option is not specified,
.B rpc.statd .B rpc.statd
uses uses
@ -39,7 +52,7 @@ diff -up nfs-utils-2.1.1/utils/statd/statd.man.orig nfs-utils-2.1.1/utils/statd/
by default. by default.
.IP .IP
After starting, After starting,
@@ -425,13 +425,13 @@ If set to a positive integer, has the sa @@ -431,13 +431,13 @@ If set to a positive integer, has the same effect as
.IR \-\-no\-notify . .IR \-\-no\-notify .
.SH FILES .SH FILES
.TP 2.5i .TP 2.5i
@ -56,3 +69,6 @@ diff -up nfs-utils-2.1.1/utils/statd/statd.man.orig nfs-utils-2.1.1/utils/statd/
NSM state number for this host NSM state number for this host
.TP 2.5i .TP 2.5i
.I /var/run/run.statd.pid .I /var/run/run.statd.pid
--
1.7.12.4

View File

@ -1,9 +0,0 @@
#
# 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

View File

@ -1,23 +0,0 @@
#
# 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

Binary file not shown.

BIN
nfs-utils-2.4.2.tar.xz Normal file

Binary file not shown.

View File

@ -3,69 +3,17 @@
%global _statdpath /var/lib/nfs/statd %global _statdpath /var/lib/nfs/statd
Name: nfs-utils Name: nfs-utils
Version: 2.3.3 Version: 2.4.2
Release: 5 Release: 1
Epoch: 1 Epoch: 1
Summary: The Linux NFS userland utility package Summary: The Linux NFS userland utility package
License: MIT and GPLv2 and GPLv2+ and BSD License: MIT and GPLv2 and GPLv2+ and BSD
URL: http://sourceforge.net/projects/nfs/ URL: http://sourceforge.net/projects/nfs/
Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{version}.tar.xz Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{version}.tar.xz
Source1: id_resolver.conf
Source2: nfs.sysconfig
Source3: nfs-utils_env.sh
Source4: lockd.conf
Source5: 24-nfs-server.conf
Patch0: 0000-nfs-utils-1.2.1-statdpath-man.patch
Patch1: 0001-nfs-utils-1.2.1-exp-subtree-warn-off.patch
Patch2: 0002-nfs-utils-1.2.5-idmap-errmsg.patch
Patch3: 0003-nfs-utils-2.1.1-nfs-config.patch
Patch4: 0004-nfs-utils-2.3.1-systemd-gssproxy-restart.patch
Patch6000: 6000-bugfix-fail-disable-major-NFS-version-4.patch
Patch6001: 6001-ignore-EBUSY-when-a-filesystem-is-already-mount.patch
Patch6002: 6002-fix-quoting-in-configure-ac.patch
Patch6003: 6003-harden-configure-ac-checks-for-libxml2.patch
Patch6004: 6004-finish-port-of-junction-support-to-nfs-util.patch
Patch6005: 6005-add-IgnoreOnIsolate-yes-in-rpc-statd-service.patch
Patch6006: 6006-improve-error-msg-when-mount-fail-with-EBUSY.patch
Patch6007: 6007-fix-with-rpcgen-internal-nottaking-effect.patch
Patch6008: 6008-do-not-fatalize-Wstrict-prototypes-with-internal-rpcgen.patch
Patch6009: 6009-run-statd-notify-even-when-nfs-client-isnot-enabled.patch
Patch6010: 6010-honour-with-pluginpath-for-instalation.patch
Patch6011: 6011-update-the-path-of-libnfs.a.patch
Patch6012: 6012-removed-new-error-format-overflow-2-errors-in-nfs-utils.patch
Patch6013: 6013-fixed-manage-gids-option-typo-in-nfs.conf.patch
Patch6014: 6014-more-carefully-detect-availability-of-res_querydomain.patch
Patch6015: 6015-fix-use-of-undefined-macro-HAVE_GETRPCBYNUMBER_R.patch
Patch6016: 6016-provide-the-UID-GID-name-for-which-mapping-fails.patch
Patch6017: 6017-add-miss-cast-to-getsockname.patch
Patch6018: 6018-add-miss-libgen-header-in-idmapd.patch
Patch6019: 6019-remove-resource-leaks-from-junction-path.c.patch
Patch6020: 6020-remove-resource-leaks-from-nfs-exports.c.patch
Patch6021: 6021-remove-a-resource-leak-from-nfs-mydaemon.c.patch
Patch6022: 6022-remove-a-resource-leak-from-nfs-rpcmisc.c.patch
Patch6023: 6023-remove-a-resource-leak-from-nfs-svc_socket.c.patch
Patch6024: 6024-remove-bad-frees-from-nfs-xcommon.c.patch
Patch6025: 6025-remove-resource-leaks-from-nfs-xlog.c.patch
Patch6026: 6026-remove-resource-leaks-from-libnfsidmap.c.patch
Patch6027: 6027-remove-resource-leaks-from-nfsidmap-static.c.patch
Patch6028: 6028-remove-a-resource-leak-from-nsm-file.c.patch
Patch6029: 6029-remove-resource-leaks-from-rpc-pipefs-generator.c.patch
Patch6030: 6030-remove-resource-leaks-from-device-discovery.patch
Patch6031: 6031-remove-resource-leaks-from-krb5_util.c.patch
Patch6032: 6032-remove-a-resource-leak-from-mount-configfile.patch
Patch6033: 6033-remove-a-resource-leak-from-mount-nfsmount.c.patch
Patch6034: 6034-remove-a-resource-leak-from-mount-stropts.c.patch
Patch6035: 6035-remove-resource-leaks-from-mountd-cache.c.patch
Patch6036: 6036-remove-a-resource-leak-from-mountd-fsloc.c.patch
Patch6037: 6037-remove-a-resource-leak-from-nfsdcltrack-sqlite.c.patch
Patch6038: 6038-report-correct-error-in-the-fall_back-cases.patch
Patch6039: 6039-fix-e_hostname-and-e_uuid-leaks-in-rpc.mountd.patch
Patch6040: 6040-donot-share-cache-file-descriptors-among-processes.patch
Patch9000: 9000-systemd-idmapd-require-rpc-pipefs.patch Patch9000: 9000-systemd-idmapd-require-rpc-pipefs.patch
Patch9001: 9001-correct-the-statd-path-in-man.patch
BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel
BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2
@ -157,19 +105,12 @@ sh -x autogen.sh
%make_install %make_install
install -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/request-key.d/id_resolver.conf install -D -m 644 utils/nfsidmap/id_resolver.conf $RPM_BUILD_ROOT%{_sysconfdir}/request-key.d/id_resolver.conf
install -D -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/nfs
install -s -m 755 tools/rpcdebug/rpcdebug $RPM_BUILD_ROOT%{_sbindir} install -s -m 755 tools/rpcdebug/rpcdebug $RPM_BUILD_ROOT%{_sbindir}
install -m 644 utils/mount/nfsmount.conf $RPM_BUILD_ROOT%{_sysconfdir} install -m 644 utils/mount/nfsmount.conf $RPM_BUILD_ROOT%{_sysconfdir}
install -m 644 nfs.conf $RPM_BUILD_ROOT%{_sysconfdir} install -m 644 nfs.conf $RPM_BUILD_ROOT%{_sysconfdir}
install -m 644 support/nfsidmap/idmapd.conf $RPM_BUILD_ROOT%{_sysconfdir} install -m 644 support/nfsidmap/idmapd.conf $RPM_BUILD_ROOT%{_sysconfdir}
install -D -m 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/nfs-utils/nfs-utils_env.sh
install -D -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/lockd.conf
install -D -m 644 %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/gssproxy/24-nfs-server.conf
touch $RPM_BUILD_ROOT%{_sharedstatedir}/nfs/rmtab touch $RPM_BUILD_ROOT%{_sharedstatedir}/nfs/rmtab
mv $RPM_BUILD_ROOT%{_sbindir}/rpc.statd $RPM_BUILD_ROOT/sbin mv $RPM_BUILD_ROOT%{_sbindir}/rpc.statd $RPM_BUILD_ROOT/sbin
@ -229,7 +170,6 @@ if [ $1 -eq 1 ] ; then
/bin/systemctl start nfs-client.target &> /dev/null || : /bin/systemctl start nfs-client.target &> /dev/null || :
fi fi
%systemd_post nfs-config
%systemd_post nfs-server %systemd_post nfs-server
/bin/systemctl try-restart gssproxy &> /dev/null || : /bin/systemctl try-restart gssproxy &> /dev/null || :
@ -249,27 +189,22 @@ fi
%files %files
%doc support/nfsidmap/AUTHORS linux-nfs/README linux-nfs/THANKS %doc support/nfsidmap/AUTHORS linux-nfs/README linux-nfs/THANKS
%license support/nfsidmap/COPYING %license support/nfsidmap/COPYING
%config(noreplace) /etc/sysconfig/nfs
%config(noreplace) /etc/nfsmount.conf %config(noreplace) /etc/nfsmount.conf
%config(noreplace) %{_sharedstatedir}/nfs/etab %config(noreplace) %{_sharedstatedir}/nfs/etab
%config(noreplace) %{_sharedstatedir}/nfs/rmtab %config(noreplace) %{_sharedstatedir}/nfs/rmtab
%config(noreplace) %{_sysconfdir}/idmapd.conf %config(noreplace) %{_sysconfdir}/idmapd.conf
%config(noreplace) %{_sysconfdir}/request-key.d/id_resolver.conf %config(noreplace) %{_sysconfdir}/request-key.d/id_resolver.conf
%config(noreplace) %{_sysconfdir}/modprobe.d/lockd.conf
%config(noreplace) %{_sysconfdir}/nfs.conf %config(noreplace) %{_sysconfdir}/nfs.conf
%dir %{_sysconfdir}/exports.d %dir %{_sysconfdir}/exports.d
%dir %{_sharedstatedir}/nfs %dir %{_sharedstatedir}/nfs
%dir %{_sharedstatedir}/nfs/v4recovery %dir %{_sharedstatedir}/nfs/v4recovery
%dir %{_sharedstatedir}/nfs/rpc_pipefs %dir %{_sharedstatedir}/nfs/rpc_pipefs
%dir %{_libexecdir}/nfs-utils
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd %dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm %dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm
%dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm.bak %dir %attr(700,rpcuser,rpcuser) %{_sharedstatedir}/nfs/statd/sm.bak
%ghost %attr(644,rpcuser,rpcuser) %{_statdpath}/state %ghost %attr(644,rpcuser,rpcuser) %{_statdpath}/state
%attr(0600,root,root) %config(noreplace) /%{_sysconfdir}/gssproxy/24-nfs-server.conf
%attr(4755,root,root) /sbin/mount.nfs %attr(4755,root,root) /sbin/mount.nfs
%attr(755,root,root) %{_libexecdir}/nfs-utils/nfs-utils_env.sh /sbin/{rpc.statd,nfsdcltrack,osd_login,mount.nfs4,umount.*,nfsdcld}
/sbin/{rpc.statd,nfsdcltrack,osd_login,mount.nfs4,umount.*}
%{_sbindir}/* %{_sbindir}/*
%{_prefix}/lib/systemd/*/* %{_prefix}/lib/systemd/*/*
%{_libdir}/libnfsidmap.so.* %{_libdir}/libnfsidmap.so.*
@ -285,6 +220,12 @@ fi
%{_mandir}/*/* %{_mandir}/*/*
%changelog %changelog
* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.4.2-1
- Type:enhancemnet
- ID:NA
- SUG:NA
- DESC:update the package from 2.3.3 version to 2.4.2
* Sun Dec 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.3.3-5 * Sun Dec 29 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.3.3-5
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA
@ -294,5 +235,5 @@ fi
* Sun Sep 29 2019 zhanghaibo <ted.zhang@huawei.com> - 2.3.3-4 * Sun Sep 29 2019 zhanghaibo <ted.zhang@huawei.com> - 2.3.3-4
- Remove some comments - Remove some comments
* Tue Sep 05 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.3.3-3 * Thu Sep 05 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.3.3-3
- Package init - Package init

View File

@ -1,45 +0,0 @@
#!/bin/sh
#
# Extract configuration from /etc/sysconfig/nfs and write
# environment variables to /run/sysconfig/nfs-utils to be
# used by systemd nfs-config service
#
nfs_config=/etc/sysconfig/nfs
if test -r $nfs_config; then
. $nfs_config
fi
if [ -n "$NFSD_V4_GRACE" ]; then
grace="-G $NFSD_V4_GRACE"
fi
if [ -n "$NFSD_V4_LEASE" ]; then
lease="-L $NFSD_V4_LEASE"
fi
if [ -n "$RPCNFSDCOUNT" ]; then
nfsds=$RPCNFSDCOUNT
else
nfsds=8
fi
if [ -n "$RPCNFSDARGS" ]; then
nfsdargs="$RPCNFSDARGS $grace $lease $nfsds"
else
nfsdargs="$grace $lease $nfsds"
fi
mkdir -p /run/sysconfig
{
echo RPCNFSDARGS=\"$nfsdargs\"
echo RPCMOUNTDARGS=\"$RPCMOUNTDOPTS\"
echo STATDARGS=\"$STATDARGS\"
echo SMNOTIFYARGS=\"$SMNOTIFYARGS\"
echo RPCIDMAPDARGS=\"$RPCIDMAPDARGS\"
echo RPCGSSDARGS=\"$RPCGSSDARGS\"
echo RPCSVCGSSDARGS=\"$RPCSVCGSSDARGS\"
echo BLKMAPDARGS=\"$BLKMAPDARGS\"
echo GSS_USE_PROXY=\"$GSS_USE_PROXY\"
} > /run/sysconfig/nfs-utils

View File

@ -1,38 +0,0 @@
#
#
# To set lockd kernel module parameters please see
# /etc/modprobe.d/lockd.conf
#
#
# Optional arguments passed to rpc.nfsd. See rpc.nfsd(8)
RPCNFSDARGS=""
# Number of nfs server processes to be started.
# The default is 8.
# RPCNFSDCOUNT=16
#
# Set V4 grace period in seconds
#NFSD_V4_GRACE=90
#
# Set V4 lease period in seconds
#NFSD_V4_LEASE=90
#
# Optional arguments passed to rpc.mountd. See rpc.mountd(8)
RPCMOUNTDOPTS=""
#
# Optional arguments passed to rpc.statd. See rpc.statd(8)
STATDARGS=""
# Optional arguments passed to sm-notify. See sm-notify(8)
SMNOTIFYARGS=""
#
#
# Optional arguments passed to rpc.idmapd. See rpc.idmapd(8)
RPCIDMAPDARGS=""
#
# Optional arguments passed to rpc.gssd. See rpc.gssd(8)
RPCGSSDARGS=""
# Enable usage of gssproxy. See gssproxy-mech(8).
GSS_USE_PROXY="yes"
#
# Optional arguments passed to blkmapd. See blkmapd(8)
BLKMAPDARGS=""