summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils/nfs-utils
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils')
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Don-t-build-tools-with-CC_FOR_BUILD.patch40
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-include-order-between-config.h-and-stat.h.patch156
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch295
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-cacheio-use-intmax_t-for-formatted-IO.patch38
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch43
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch40
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/0001-nfs-utils-statd-fix-a-segfault-caused-by-improper-us.patch113
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/bugfix-adjust-statd-service-name.patch39
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch183
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service10
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service12
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service10
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch36
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch42
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-debianize-start-statd.patch42
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-musl-res_querydomain.patch46
-rw-r--r--meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver4
17 files changed, 904 insertions, 245 deletions
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Don-t-build-tools-with-CC_FOR_BUILD.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Don-t-build-tools-with-CC_FOR_BUILD.patch
new file mode 100644
index 0000000000..23bc3eaf72
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Don-t-build-tools-with-CC_FOR_BUILD.patch
@@ -0,0 +1,40 @@
+From 79019d976584c598f8d0a9d8de43c989946f974b Mon Sep 17 00:00:00 2001
+From: Pascal Bach <pascal.bach@siemens.com>
+Date: Wed, 13 Feb 2019 09:28:07 +0100
+Subject: [PATCH] Don't build tools with CC_FOR_BUILD
+
+The tools are intended for the target not for the host.
+
+Upstream-Status: Pending
+
+Signed-off-by: Pascal Bach <pascal.bach@siemens.com>
+---
+ tools/locktest/Makefile.am | 1 -
+ tools/rpcgen/Makefile.am | 1 -
+ 2 files changed, 2 deletions(-)
+
+diff --git a/tools/locktest/Makefile.am b/tools/locktest/Makefile.am
+index 3156815..87d0bac 100644
+--- a/tools/locktest/Makefile.am
++++ b/tools/locktest/Makefile.am
+@@ -1,6 +1,5 @@
+ ## Process this file with automake to produce Makefile.in
+
+-CC=$(CC_FOR_BUILD)
+ LIBTOOL = @LIBTOOL@ --tag=CC
+
+ noinst_PROGRAMS = testlk
+diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am
+index 8a9ec89..3e092c9 100644
+--- a/tools/rpcgen/Makefile.am
++++ b/tools/rpcgen/Makefile.am
+@@ -1,6 +1,5 @@
+ ## Process this file with automake to produce Makefile.in
+
+-CC=$(CC_FOR_BUILD)
+ LIBTOOL = @LIBTOOL@ --tag=CC
+
+ noinst_PROGRAMS = rpcgen
+--
+2.11.0
+
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-include-order-between-config.h-and-stat.h.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-include-order-between-config.h-and-stat.h.patch
new file mode 100644
index 0000000000..7b0f93535f
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Fix-include-order-between-config.h-and-stat.h.patch
@@ -0,0 +1,156 @@
+From 2fbc62e2a13fc22b6ae4910e295a2c10fb790486 Mon Sep 17 00:00:00 2001
+From: Zoltan Karcagi <zkr7432@gmail.com>
+Date: Mon, 12 Aug 2019 13:27:16 -0400
+Subject: [PATCH] Fix include order between config.h and stat.h
+
+At least on Arch linux ARM, the definition of struct stat in stat.h depends
+on __USE_FILE_OFFSET64. This symbol comes from config.h when defined,
+therefore config.h must always be included before stat.h. Fix all
+occurrences where the order is wrong by moving config.h to the top.
+
+This fixes the client side error "Stale file handle" when mounting from
+a server running Arch Linux ARM.
+
+Signed-off-by: Zoltan Karcagi <zkr7432@gmail.com>
+Signed-off-by: Steve Dickson <steved@redhat.com>
+
+Upstream-Status: Backport
+[http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=2fbc62e2a13fc22b6ae4910e295a2c10fb790486]
+
+Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
+---
+ support/misc/nfsd_path.c | 5 ++++-
+ support/misc/xstat.c | 5 ++++-
+ support/nfs/conffile.c | 8 +++++++-
+ utils/blkmapd/device-discovery.c | 8 ++++----
+ utils/idmapd/idmapd.c | 8 ++++----
+ 5 files changed, 23 insertions(+), 11 deletions(-)
+
+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/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/idmapd/idmapd.c b/utils/idmapd/idmapd.c
+index 62e37b8..267acea 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"
+--
+2.7.4
+
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch
new file mode 100644
index 0000000000..fcb0e99b33
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch
@@ -0,0 +1,295 @@
+From 690a90a5b7786e40b5447ad7c5f19a7657d27405 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <Mingli.Yu@windriver.com>
+Date: Fri, 14 Dec 2018 17:44:32 +0800
+Subject: [PATCH] Makefile.am: fix undefined function for libnsm.a
+
+The source file of libnsm.a uses some function
+in ../support/misc/file.c, add ../support/misc/file.c
+to libnsm_a_SOURCES to fix build error when run
+"make -C tests statdb_dump":
+| ../support/nsm/libnsm.a(file.o): In function `nsm_make_pathname':
+| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname'
+| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname'
+| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:175: undefined reference to `generic_make_pathname'
+| ../support/nsm/libnsm.a(file.o): In function `nsm_setup_pathnames':
+| /usr/src/debug/nfs-utils/2.3.3-r0/nfs-utils-2.3.3/support/nsm/file.c:280: undefined reference to `generic_setup_basedir'
+| collect2: error: ld returned 1 exit status
+
+As there is already one source file named file.c
+as support/nsm/file.c in support/nsm/Makefile.am,
+so rename ../support/misc/file.c to ../support/misc/misc.c.
+
+Upstream-Status: Submitted[https://marc.info/?l=linux-nfs&m=154502780423058&w=2]
+
+Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
+
+Rebase it.
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ support/misc/Makefile.am | 2 +-
+ support/misc/file.c | 111 ---------------------------------------------------------------------------------------------------------------
+ support/misc/misc.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ support/nsm/Makefile.am | 2 +-
+ 4 files changed, 113 insertions(+), 113 deletions(-)
+
+diff --git a/support/misc/Makefile.am b/support/misc/Makefile.am
+index f9993e3..8b0e9db 100644
+--- a/support/misc/Makefile.am
++++ b/support/misc/Makefile.am
+@@ -1,7 +1,7 @@
+ ## Process this file with automake to produce Makefile.in
+
+ noinst_LIBRARIES = libmisc.a
+-libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c file.c \
++libmisc_a_SOURCES = tcpwrapper.c from_local.c mountpoint.c misc.c \
+ nfsd_path.c workqueue.c xstat.c
+
+ MAINTAINERCLEANFILES = Makefile.in
+diff --git a/support/misc/file.c b/support/misc/file.c
+deleted file mode 100644
+index e7c3819..0000000
+--- a/support/misc/file.c
++++ /dev/null
+@@ -1,111 +0,0 @@
+-/*
+- * Copyright 2009 Oracle. All rights reserved.
+- * Copyright 2017 Red Hat, Inc. All rights reserved.
+- *
+- * This file is part of nfs-utils.
+- *
+- * nfs-utils is free software; you can redistribute it and/or modify
+- * it under the terms of the GNU General Public License as published by
+- * the Free Software Foundation; either version 2 of the License, or
+- * (at your option) any later version.
+- *
+- * nfs-utils 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 nfs-utils. If not, see <http://www.gnu.org/licenses/>.
+- */
+-
+-#include <sys/stat.h>
+-
+-#include <string.h>
+-#include <libgen.h>
+-#include <stdio.h>
+-#include <errno.h>
+-#include <dirent.h>
+-#include <stdlib.h>
+-#include <stdbool.h>
+-#include <limits.h>
+-
+-#include "xlog.h"
+-#include "misc.h"
+-
+-/*
+- * Returns a dynamically allocated, '\0'-terminated buffer
+- * containing an appropriate pathname, or NULL if an error
+- * occurs. Caller must free the returned result with free(3).
+- */
+-__attribute__((__malloc__))
+-char *
+-generic_make_pathname(const char *base, const char *leaf)
+-{
+- size_t size;
+- char *path;
+- int len;
+-
+- size = strlen(base) + strlen(leaf) + 2;
+- if (size > PATH_MAX)
+- return NULL;
+-
+- path = malloc(size);
+- if (path == NULL)
+- return NULL;
+-
+- len = snprintf(path, size, "%s/%s", base, leaf);
+- if ((len < 0) || ((size_t)len >= size)) {
+- free(path);
+- return NULL;
+- }
+-
+- return path;
+-}
+-
+-
+-/**
+- * generic_setup_basedir - set up basedir
+- * @progname: C string containing name of program, for error messages
+- * @parentdir: C string containing pathname to on-disk state, or NULL
+- * @base: character buffer to contain the basedir that is set up
+- * @baselen: size of @base in bytes
+- *
+- * This runs before logging is set up, so error messages are directed
+- * to stderr.
+- *
+- * Returns true and sets up our basedir, if @parentdir was valid
+- * and usable; otherwise false is returned.
+- */
+-_Bool
+-generic_setup_basedir(const char *progname, const char *parentdir, char *base,
+- const size_t baselen)
+-{
+- static char buf[PATH_MAX];
+- struct stat st;
+- char *path;
+-
+- /* First: test length of name and whether it exists */
+- if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
+- (void)fprintf(stderr, "%s: Directory name too long: %s",
+- progname, parentdir);
+- return false;
+- }
+- if (lstat(parentdir, &st) == -1) {
+- (void)fprintf(stderr, "%s: Failed to stat %s: %s",
+- progname, parentdir, strerror(errno));
+- return false;
+- }
+-
+- /* Ensure we have a clean directory pathname */
+- strncpy(buf, parentdir, sizeof(buf)-1);
+- path = dirname(buf);
+- if (*path == '.') {
+- (void)fprintf(stderr, "%s: Unusable directory %s",
+- progname, parentdir);
+- return false;
+- }
+-
+- xlog(D_CALL, "Using %s as the state directory", parentdir);
+- strcpy(base, parentdir);
+- return true;
+-}
+diff --git a/support/misc/misc.c b/support/misc/misc.c
+new file mode 100644
+index 0000000..e7c3819
+--- /dev/null
++++ b/support/misc/misc.c
+@@ -0,0 +1,111 @@
++/*
++ * Copyright 2009 Oracle. All rights reserved.
++ * Copyright 2017 Red Hat, Inc. All rights reserved.
++ *
++ * This file is part of nfs-utils.
++ *
++ * nfs-utils is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * nfs-utils 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 nfs-utils. If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <sys/stat.h>
++
++#include <string.h>
++#include <libgen.h>
++#include <stdio.h>
++#include <errno.h>
++#include <dirent.h>
++#include <stdlib.h>
++#include <stdbool.h>
++#include <limits.h>
++
++#include "xlog.h"
++#include "misc.h"
++
++/*
++ * Returns a dynamically allocated, '\0'-terminated buffer
++ * containing an appropriate pathname, or NULL if an error
++ * occurs. Caller must free the returned result with free(3).
++ */
++__attribute__((__malloc__))
++char *
++generic_make_pathname(const char *base, const char *leaf)
++{
++ size_t size;
++ char *path;
++ int len;
++
++ size = strlen(base) + strlen(leaf) + 2;
++ if (size > PATH_MAX)
++ return NULL;
++
++ path = malloc(size);
++ if (path == NULL)
++ return NULL;
++
++ len = snprintf(path, size, "%s/%s", base, leaf);
++ if ((len < 0) || ((size_t)len >= size)) {
++ free(path);
++ return NULL;
++ }
++
++ return path;
++}
++
++
++/**
++ * generic_setup_basedir - set up basedir
++ * @progname: C string containing name of program, for error messages
++ * @parentdir: C string containing pathname to on-disk state, or NULL
++ * @base: character buffer to contain the basedir that is set up
++ * @baselen: size of @base in bytes
++ *
++ * This runs before logging is set up, so error messages are directed
++ * to stderr.
++ *
++ * Returns true and sets up our basedir, if @parentdir was valid
++ * and usable; otherwise false is returned.
++ */
++_Bool
++generic_setup_basedir(const char *progname, const char *parentdir, char *base,
++ const size_t baselen)
++{
++ static char buf[PATH_MAX];
++ struct stat st;
++ char *path;
++
++ /* First: test length of name and whether it exists */
++ if ((strlen(parentdir) >= baselen) || (strlen(parentdir) >= PATH_MAX)) {
++ (void)fprintf(stderr, "%s: Directory name too long: %s",
++ progname, parentdir);
++ return false;
++ }
++ if (lstat(parentdir, &st) == -1) {
++ (void)fprintf(stderr, "%s: Failed to stat %s: %s",
++ progname, parentdir, strerror(errno));
++ return false;
++ }
++
++ /* Ensure we have a clean directory pathname */
++ strncpy(buf, parentdir, sizeof(buf)-1);
++ path = dirname(buf);
++ if (*path == '.') {
++ (void)fprintf(stderr, "%s: Unusable directory %s",
++ progname, parentdir);
++ return false;
++ }
++
++ xlog(D_CALL, "Using %s as the state directory", parentdir);
++ strcpy(base, parentdir);
++ return true;
++}
+diff --git a/support/nsm/Makefile.am b/support/nsm/Makefile.am
+index 8f5874e..68f1a46 100644
+--- a/support/nsm/Makefile.am
++++ b/support/nsm/Makefile.am
+@@ -10,7 +10,7 @@ GENFILES = $(GENFILES_CLNT) $(GENFILES_SVC) $(GENFILES_XDR) $(GENFILES_H)
+ EXTRA_DIST = sm_inter.x
+
+ noinst_LIBRARIES = libnsm.a
+-libnsm_a_SOURCES = $(GENFILES) file.c rpc.c
++libnsm_a_SOURCES = $(GENFILES) ../misc/misc.c file.c rpc.c
+
+ BUILT_SOURCES = $(GENFILES)
+
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-cacheio-use-intmax_t-for-formatted-IO.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-cacheio-use-intmax_t-for-formatted-IO.patch
new file mode 100644
index 0000000000..bafff5b9c0
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-cacheio-use-intmax_t-for-formatted-IO.patch
@@ -0,0 +1,38 @@
+From ac32b813f5d6f9a2de944015cf9bb98d68e0203a Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 1 Dec 2018 10:02:12 -0800
+Subject: [PATCH] cacheio: use intmax_t for formatted IO
+
+time_t is not same size on x32 ABI (ILP32)
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ support/nfs/cacheio.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c
+index 9dc4cf1..2086a95 100644
+--- a/support/nfs/cacheio.c
++++ b/support/nfs/cacheio.c
+@@ -17,6 +17,7 @@
+
+ #include <nfslib.h>
+ #include <stdio.h>
++#include <inttypes.h>
+ #include <stdio_ext.h>
+ #include <string.h>
+ #include <ctype.h>
+@@ -234,7 +235,7 @@ cache_flush(int force)
+ stb.st_mtime > now)
+ stb.st_mtime = time(0);
+
+- sprintf(stime, "%ld\n", stb.st_mtime);
++ sprintf(stime, "%jd\n", (intmax_t)stb.st_mtime);
+ for (c=0; cachelist[c]; c++) {
+ int fd;
+ sprintf(path, "/proc/net/rpc/%s/flush", cachelist[c]);
+--
+2.19.2
+
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch
deleted file mode 100644
index 7025fb555c..0000000000
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure-Allow-to-explicitly-disable-nfsidmap.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-From 9b84cff305866abd150cf1a4c6e7e5ebf8a7eb3a Mon Sep 17 00:00:00 2001
-From: Martin Jansa <Martin.Jansa@gmail.com>
-Date: Fri, 15 Nov 2013 23:21:35 +0100
-Subject: [PATCH] configure: Allow to explicitly disable nfsidmap
-
-* keyutils availability is autodetected and builds aren't reproducible
-
-Upstream-Status: Pending
-
-Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
----
- configure.ac | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index bf433d6..28a8f62 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -69,6 +69,12 @@ AC_ARG_ENABLE(nfsv4,
- AC_SUBST(enable_nfsv4)
- AM_CONDITIONAL(CONFIG_NFSV4, [test "$enable_nfsv4" = "yes"])
-
-+AC_ARG_ENABLE(nfsidmap,
-+ [AC_HELP_STRING([--enable-nfsidmap],
-+ [enable support for NFSv4 idmapper @<:@default=yes@:>@])],
-+ enable_nfsidmap=$enableval,
-+ enable_nfsidmap=yes)
-+
- AC_ARG_ENABLE(nfsv41,
- [AC_HELP_STRING([--enable-nfsv41],
- [enable support for NFSv41 @<:@default=yes@:>@])],
-@@ -296,7 +302,7 @@ fi
-
- dnl enable nfsidmap when its support by libnfsidmap
- AM_CONDITIONAL(CONFIG_NFSDCLTRACK, [test "$enable_nfsdcltrack" = "yes" ])
--AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyes"])
-+AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$enable_nfsidmap$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyesyes"])
-
-
- if test "$knfsd_cv_glibc2" = no; then
---
-1.8.4.3
-
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch
new file mode 100644
index 0000000000..d14f0789ff
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch
@@ -0,0 +1,40 @@
+From 66471fbf7106917da7a1536b18a0a77d07479779 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <Mingli.Yu@windriver.com>
+Date: Mon, 17 Dec 2018 15:29:47 +0800
+Subject: [PATCH] configure.ac: Do not fatalize -Wmissing-prototypes
+
+There comes below error when run "make -C tests/nsm_client nsm_client"
+| nlm_sm_inter_svc.c:20:1: error: no previous prototype for 'nlm_sm_prog_3' [-Werror=missing-prototypes]
+
+It is because rpcgen doesn't generate -Wmissing-prototypes
+free code for nlm_sm_inter_svc.c with below logic
+in tests/nsm_client/Makefile.am
+[snip]
+GENFILES_SVC = nlm_sm_inter_svc.c
+[snip]
+$(GENFILES_SVC): %_svc.c: %.x $(RPCGEN)
+ test -f $@ && rm -rf $@ || true
+ $(RPCGEN) -m -o $@ $<
+
+So add the logic not to fatalize -Wmissing-prototypes.
+
+Upstream-Status: Submitted[https://marc.info/?l=linux-nfs&m=154503260323936&w=2]
+
+Signed-off-by: Mingli Yu <Mingli.Yu@windriver.com>
+---
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 50002b4..aebff01 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -582,7 +582,7 @@ my_am_cflags="\
+ -Wall \
+ -Wextra \
+ $rpcgen_cflags \
+- -Werror=missing-prototypes \
++ -Wmissing-prototypes \
+ -Werror=missing-declarations \
+ -Werror=format=2 \
+ -Werror=undef \
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-nfs-utils-statd-fix-a-segfault-caused-by-improper-us.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-nfs-utils-statd-fix-a-segfault-caused-by-improper-us.patch
deleted file mode 100644
index de0b045c8c..0000000000
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-nfs-utils-statd-fix-a-segfault-caused-by-improper-us.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-Upstream-Status: Pending
-
-Subject: nfs-utils/statd: fix a segfault caused by improper usage of RPC interface
-
-There is a hack which uses the bottom-level RPC improperly as below
-in the current statd implementation:
-insert a socket in the svc_fdset without a corresponding transport handle
-and passes the socket to the svc_getreqset subroutine, this usage causes
-a segfault of statd on a huge amount of sm-notifications.
-
-Fix the issue by separating the non-RPC-server sock from RPC dispatcher.
-
-Signed-off-by: Shan Hai <shan.hai@windriver.com>
-Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
----
- utils/statd/rmtcall.c | 1 -
- utils/statd/statd.c | 5 +++--
- utils/statd/statd.h | 2 +-
- utils/statd/svc_run.c | 8 ++++++--
- 4 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/utils/statd/rmtcall.c b/utils/statd/rmtcall.c
-index fd576d9..cde091b 100644
---- a/utils/statd/rmtcall.c
-+++ b/utils/statd/rmtcall.c
-@@ -104,7 +104,6 @@ statd_get_socket(void)
- if (sockfd < 0)
- return -1;
-
-- FD_SET(sockfd, &SVC_FDSET);
- return sockfd;
- }
-
-diff --git a/utils/statd/statd.c b/utils/statd/statd.c
-index 51a016e..e21a259 100644
---- a/utils/statd/statd.c
-+++ b/utils/statd/statd.c
-@@ -247,6 +247,7 @@ int main (int argc, char **argv)
- int port = 0, out_port = 0;
- int nlm_udp = 0, nlm_tcp = 0;
- struct rlimit rlim;
-+ int notify_sockfd;
-
- int pipefds[2] = { -1, -1};
- char status;
-@@ -473,7 +474,7 @@ int main (int argc, char **argv)
- }
-
- /* Make sure we have a privilege port for calling into the kernel */
-- if (statd_get_socket() < 0)
-+ if ((notify_sockfd = statd_get_socket()) < 0)
- exit(1);
-
- /* If sm-notify didn't take all the state files, load
-@@ -528,7 +529,7 @@ int main (int argc, char **argv)
- * Handle incoming requests: SM_NOTIFY socket requests, as
- * well as callbacks from lockd.
- */
-- my_svc_run(); /* I rolled my own, Olaf made it better... */
-+ my_svc_run(notify_sockfd); /* I rolled my own, Olaf made it better... */
-
- /* Only get here when simulating a crash so we should probably
- * start sm-notify running again. As we have already dropped
-diff --git a/utils/statd/statd.h b/utils/statd/statd.h
-index a1d8035..231ac7e 100644
---- a/utils/statd/statd.h
-+++ b/utils/statd/statd.h
-@@ -28,7 +28,7 @@ extern _Bool statd_present_address(const struct sockaddr *sap, char *buf,
- __attribute__((__malloc__))
- extern char * statd_canonical_name(const char *hostname);
-
--extern void my_svc_run(void);
-+extern void my_svc_run(int);
- extern void notify_hosts(void);
- extern void shuffle_dirs(void);
- extern int statd_get_socket(void);
-diff --git a/utils/statd/svc_run.c b/utils/statd/svc_run.c
-index d98ecee..28c1ad6 100644
---- a/utils/statd/svc_run.c
-+++ b/utils/statd/svc_run.c
-@@ -78,7 +78,7 @@ my_svc_exit(void)
- * The heart of the server. A crib from libc for the most part...
- */
- void
--my_svc_run(void)
-+my_svc_run(int sockfd)
- {
- FD_SET_TYPE readfds;
- int selret;
-@@ -96,6 +96,8 @@ my_svc_run(void)
- }
-
- readfds = SVC_FDSET;
-+ /* Set notify sockfd for waiting for reply */
-+ FD_SET(sockfd, &readfds);
- if (notify) {
- struct timeval tv;
-
-@@ -125,8 +127,10 @@ my_svc_run(void)
-
- default:
- selret -= process_reply(&readfds);
-- if (selret)
-+ if (selret) {
-+ FD_CLR(sockfd, &readfds);
- svc_getreqset(&readfds);
-+ }
- }
- }
- }
---
-1.9.1
-
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/bugfix-adjust-statd-service-name.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/bugfix-adjust-statd-service-name.patch
new file mode 100644
index 0000000000..f13d7b380c
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/bugfix-adjust-statd-service-name.patch
@@ -0,0 +1,39 @@
+From 398fed3bb0350cb1229e54e7020ae0e044c206d1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Ulrich=20=C3=96lmann?= <u.oelmann@pengutronix.de>
+Date: Wed, 17 Feb 2016 08:33:45 +0100
+Subject: bugfix: adjust statd service name
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream uses 'rpc-statd.service' and Yocto introduced 'nfs-statd.service'
+instead but forgot to update the mount.nfs helper 'start-statd' accordingly.
+
+Upstream-Status: Inappropriate [other]
+
+Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
+
+Rebase it.
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ utils/statd/start-statd | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/utils/statd/start-statd b/utils/statd/start-statd
+index af5c950..df9b9be 100755
+--- a/utils/statd/start-statd
++++ b/utils/statd/start-statd
+@@ -28,10 +28,10 @@ fi
+ # First try systemd if it's installed.
+ if [ -d /run/systemd/system ]; then
+ # Quit only if the call worked.
+- if systemctl start rpc-statd.service; then
++ if systemctl start nfs-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
++ systemctl add-wants --runtime remote-fs.target nfs-statd.service
+ exit 0
+ fi
+ fi
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch
new file mode 100644
index 0000000000..1d693e4142
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-format-string.patch
@@ -0,0 +1,183 @@
+Clang comes up with more printf format warnings
+Correcting “format string is not a string literal” warning
+requires us to declare that parameter is a printf style
+format using the attribute flag
+
+Upstream-Status: Pending
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Index: nfs-utils-2.3.3/support/include/xcommon.h
+===================================================================
+--- nfs-utils-2.3.3.orig/support/include/xcommon.h
++++ nfs-utils-2.3.3/support/include/xcommon.h
+@@ -27,7 +27,7 @@
+
+ /* Functions in sundries.c that are used in mount.c and umount.c */
+ char *canonicalize (const char *path);
+-void nfs_error (const char *fmt, ...);
++void nfs_error (const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
+ void *xmalloc (size_t size);
+ void *xrealloc(void *p, size_t size);
+ void xfree(void *);
+@@ -36,9 +36,9 @@ char *xstrndup (const char *s, int n);
+ char *xstrconcat2 (const char *, const char *);
+ char *xstrconcat3 (const char *, const char *, const char *);
+ char *xstrconcat4 (const char *, const char *, const char *, const char *);
+-void die (int errcode, const char *fmt, ...);
++void die (int errcode, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
+
+-extern void die(int err, const char *fmt, ...);
++extern void die(int err, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
+ extern void (*at_die)(void);
+
+ /* exit status - bits below are ORed */
+Index: nfs-utils-2.3.3/support/include/xlog.h
+===================================================================
+--- nfs-utils-2.3.3.orig/support/include/xlog.h
++++ nfs-utils-2.3.3/support/include/xlog.h
+@@ -43,10 +43,10 @@ void xlog_config(int fac, int on);
+ void xlog_sconfig(char *, int on);
+ void xlog_from_conffile(char *);
+ int xlog_enabled(int fac);
+-void xlog(int fac, const char *fmt, ...);
+-void xlog_warn(const char *fmt, ...);
+-void xlog_err(const char *fmt, ...);
+-void xlog_errno(int err, const char *fmt, ...);
+-void xlog_backend(int fac, const char *fmt, va_list args);
++void xlog(int fac, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
++void xlog_warn(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
++void xlog_err(const char *fmt, ...) __attribute__((__format__ (__printf__, 1, 2)));
++void xlog_errno(int err, const char *fmt, ...) __attribute__((__format__ (__printf__, 2, 3)));
++void xlog_backend(int fac, const char *fmt, va_list args) __attribute__((__format__ (__printf__, 2, 0)));
+
+ #endif /* XLOG_H */
+Index: nfs-utils-2.3.3/support/nfs/xcommon.c
+===================================================================
+--- nfs-utils-2.3.3.orig/support/nfs/xcommon.c
++++ nfs-utils-2.3.3/support/nfs/xcommon.c
+@@ -93,7 +93,10 @@ nfs_error (const char *fmt, ...) {
+
+ fmt2 = xstrconcat2 (fmt, "\n");
+ va_start (args, fmt);
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wformat-nonliteral"
+ vfprintf (stderr, fmt2, args);
++#pragma clang diagnostic pop
+ va_end (args);
+ free (fmt2);
+ }
+Index: nfs-utils-2.3.3/utils/exportfs/exportfs.c
+===================================================================
+--- nfs-utils-2.3.3.orig/utils/exportfs/exportfs.c
++++ nfs-utils-2.3.3/utils/exportfs/exportfs.c
+@@ -644,6 +644,7 @@ out:
+ return result;
+ }
+
++__attribute__((__format__ (__printf__, 2, 3)))
+ static char
+ dumpopt(char c, char *fmt, ...)
+ {
+Index: nfs-utils-2.3.3/utils/statd/statd.c
+===================================================================
+--- nfs-utils-2.3.3.orig/utils/statd/statd.c
++++ nfs-utils-2.3.3/utils/statd/statd.c
+@@ -136,7 +136,7 @@ static void log_modes(void)
+ strcat(buf, "TI-RPC ");
+ #endif
+
+- xlog_warn(buf);
++ xlog_warn("%s", buf);
+ }
+
+ /*
+Index: nfs-utils-2.3.3/support/nfs/svc_create.c
+===================================================================
+--- nfs-utils-2.3.3.orig/support/nfs/svc_create.c
++++ nfs-utils-2.3.3/support/nfs/svc_create.c
+@@ -184,7 +184,7 @@ svc_create_sock(const struct sockaddr *s
+ type = SOCK_STREAM;
+ break;
+ default:
+- xlog(D_GENERAL, "%s: Unrecognized bind address semantics: %u",
++ xlog(D_GENERAL, "%s: Unrecognized bind address semantics: %lu",
+ __func__, nconf->nc_semantics);
+ return -1;
+ }
+Index: nfs-utils-2.3.3/support/nsm/rpc.c
+===================================================================
+--- nfs-utils-2.3.3.orig/support/nsm/rpc.c
++++ nfs-utils-2.3.3/support/nsm/rpc.c
+@@ -182,7 +182,7 @@ nsm_xmit_getport(const int sock, const s
+ uint32_t xid;
+ XDR xdr;
+
+- xlog(D_CALL, "Sending PMAP_GETPORT for %u, %u, udp", program, version);
++ xlog(D_CALL, "Sending PMAP_GETPORT for %lu, %lu, udp", program, version);
+
+ nsm_init_xdrmem(msgbuf, NSM_MAXMSGSIZE, &xdr);
+ xid = nsm_init_rpc_header(PMAPPROG, PMAPVERS,
+Index: nfs-utils-2.3.3/utils/mountd/cache.c
+===================================================================
+--- nfs-utils-2.3.3.orig/utils/mountd/cache.c
++++ nfs-utils-2.3.3/utils/mountd/cache.c
+@@ -968,8 +968,7 @@ lookup_export(char *dom, char *path, str
+ } else if (found_type == i && found->m_warned == 0) {
+ xlog(L_WARNING, "%s exported to both %s and %s, "
+ "arbitrarily choosing options from first",
+- path, found->m_client->m_hostname, exp->m_client->m_hostname,
+- dom);
++ path, found->m_client->m_hostname, exp->m_client->m_hostname);
+ found->m_warned = 1;
+ }
+ }
+Index: nfs-utils-2.3.3/utils/mountd/mountd.c
+===================================================================
+--- nfs-utils-2.3.3.orig/utils/mountd/mountd.c
++++ nfs-utils-2.3.3/utils/mountd/mountd.c
+@@ -213,7 +213,7 @@ static void
+ sig_hup (int sig)
+ {
+ /* don't exit on SIGHUP */
+- xlog (L_NOTICE, "Received SIGHUP... Ignoring.\n", sig);
++ xlog (L_NOTICE, "Received SIGHUP(%d)... Ignoring.\n", sig);
+ return;
+ }
+
+Index: nfs-utils-2.3.3/utils/statd/rmtcall.c
+===================================================================
+--- nfs-utils-2.3.3.orig/utils/statd/rmtcall.c
++++ nfs-utils-2.3.3/utils/statd/rmtcall.c
+@@ -247,7 +247,7 @@ process_reply(FD_SET_TYPE *rfds)
+ xlog_warn("%s: service %d not registered on localhost",
+ __func__, NL_MY_PROG(lp));
+ } else {
+- xlog(D_GENERAL, "%s: Callback to %s (for %d) succeeded",
++ xlog(D_GENERAL, "%s: Callback to %s (for %s) succeeded",
+ __func__, NL_MY_NAME(lp), NL_MON_NAME(lp));
+ }
+ nlist_free(&notify, lp);
+Index: nfs-utils-2.3.3/utils/statd/svc_run.c
+===================================================================
+--- nfs-utils-2.3.3.orig/utils/statd/svc_run.c
++++ nfs-utils-2.3.3/utils/statd/svc_run.c
+@@ -53,6 +53,7 @@
+
+ #include <errno.h>
+ #include <time.h>
++#include <inttypes.h>
+ #include "statd.h"
+ #include "notlist.h"
+
+@@ -104,8 +105,8 @@ my_svc_run(int sockfd)
+
+ tv.tv_sec = NL_WHEN(notify) - now;
+ tv.tv_usec = 0;
+- xlog(D_GENERAL, "Waiting for reply... (timeo %d)",
+- tv.tv_sec);
++ xlog(D_GENERAL, "Waiting for reply... (timeo %jd)",
++ (intmax_t)tv.tv_sec);
+ selret = select(FD_SETSIZE, &readfds,
+ (void *) 0, (void *) 0, &tv);
+ } else {
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service
index 613ddc003a..c01415de84 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-mountd.service
@@ -1,11 +1,17 @@
[Unit]
Description=NFS Mount Daemon
-After=rpcbind.service nfs-server.service
-Requires=rpcbind.service nfs-server.service
+DefaultDependencies=no
+After=rpcbind.socket
+Requires=proc-fs-nfsd.mount
+After=proc-fs-nfsd.mount
+After=network.target local-fs.target
+BindsTo=nfs-server.service
+ConditionPathExists=@SYSCONFDIR@/exports
[Service]
EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
ExecStart=@SBINDIR@/rpc.mountd -F $MOUNTD_OPTS
+LimitNOFILE=@HIGH_RLIMIT_NOFILE@
[Install]
WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service
index 147d7a7b5f..6481377d80 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-server.service
@@ -1,7 +1,12 @@
[Unit]
-Description=NFS Server
-Requires=rpcbind.service nfs-mountd.service
-After=rpcbind.service
+Description=NFS server and services
+DefaultDependencies=no
+Requires=network.target proc-fs-nfsd.mount
+Requires=nfs-mountd.service
+Wants=rpcbind.service
+After=local-fs.target
+After=network.target proc-fs-nfsd.mount rpcbind.service nfs-mountd.service
+ConditionPathExists=@SYSCONFDIR@/exports
[Service]
Type=oneshot
@@ -9,6 +14,7 @@ EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
ExecStartPre=@SBINDIR@/exportfs -r
ExecStart=@SBINDIR@/rpc.nfsd $NFSD_OPTS $NFSD_COUNT
ExecStop=@SBINDIR@/rpc.nfsd 0
+ExecStopPost=@SBINDIR@/exportfs -au
ExecStopPost=@SBINDIR@/exportfs -f
ExecReload=@SBINDIR@/exportfs -r
StandardError=syslog
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service
index 746dacf056..4fa64e1998 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-statd.service
@@ -1,12 +1,14 @@
[Unit]
-Description=NFS file locking service
-After=rpcbind.service
-Requires=rpcbind.service
-Before=remote-fs-pre.target
+Description=NFS status monitor for NFSv2/3 locking.
+DefaultDependencies=no
+Conflicts=umount.target
+Requires=nss-lookup.target rpcbind.service
+After=network.target nss-lookup.target rpcbind.service
[Service]
EnvironmentFile=-@SYSCONFDIR@/nfs-utils.conf
ExecStart=@SBINDIR@/rpc.statd -F $STATD_OPTS
+LimitNOFILE=@HIGH_RLIMIT_NOFILE@
[Install]
WantedBy=multi-user.target
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch
deleted file mode 100644
index d8f8181670..0000000000
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-1.2.3-sm-notify-res_init.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-Fixes errors like
-sm-notify[1070]: DNS resolution of a.b.c.d..com failed; retrying later
-This error will occur anytime sm-notify is run before the network if fully up,
-which is happening more and more with parallel startup systems.
-The res_init() call is simple, safe, quick, and a patch to use it should be
-able to go upstream. Presumably the whole reason sm-notify tries several
-times is to wait for possible changes to the network configuration, but without
-calling res_init() it will never be aware of those changes
-
-Backported drom Fedora
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
-
-
-diff -up nfs-utils-1.2.3/utils/statd/sm-notify.c.orig nfs-utils-1.2.3/utils/statd/sm-notify.c
---- nfs-utils-1.2.3/utils/statd/sm-notify.c.orig 2010-09-28 08:24:16.000000000 -0400
-+++ nfs-utils-1.2.3/utils/statd/sm-notify.c 2010-10-15 16:44:43.487119601 -0400
-@@ -28,6 +28,9 @@
- #include <netdb.h>
- #include <errno.h>
- #include <grp.h>
-+#include <netinet/in.h>
-+#include <arpa/nameser.h>
-+#include <resolv.h>
-
- #include "sockaddr.h"
- #include "xlog.h"
-@@ -84,6 +87,7 @@ smn_lookup(const char *name)
- };
- int error;
-
-+ res_init();
- error = getaddrinfo(name, NULL, &hint, &ai);
- if (error != 0) {
- xlog(D_GENERAL, "getaddrinfo(3): %s", gai_strerror(error));
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch
deleted file mode 100644
index 993f1e5ea5..0000000000
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-Do-not-pass-CFLAGS-to-gcc-while-building.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-nfs-utils: Do not pass CFLAGS to gcc while building
-
-Do not pass CFLAGS/LDFLAGS to gcc while building, The needed flags has
-been passed by xxx_CFLAGS=$(CFLAGS_FOR_BUILD).
-
-Upstream-Status: Pending
-
-Signed-off-by: Chong Lu <Chong.Lu@windriver.com>
----
- tools/locktest/Makefile.am | 2 ++
- tools/rpcgen/Makefile.am | 2 ++
- 2 files changed, 4 insertions(+)
-
-diff --git a/tools/locktest/Makefile.am b/tools/locktest/Makefile.am
-index 3156815..1729fd1 100644
---- a/tools/locktest/Makefile.am
-+++ b/tools/locktest/Makefile.am
-@@ -1,6 +1,8 @@
- ## Process this file with automake to produce Makefile.in
-
- CC=$(CC_FOR_BUILD)
-+CFLAGS=
-+LDFLAGS=
- LIBTOOL = @LIBTOOL@ --tag=CC
-
- noinst_PROGRAMS = testlk
-diff --git a/tools/rpcgen/Makefile.am b/tools/rpcgen/Makefile.am
-index 8a9ec89..8bacdaa 100644
---- a/tools/rpcgen/Makefile.am
-+++ b/tools/rpcgen/Makefile.am
-@@ -1,6 +1,8 @@
- ## Process this file with automake to produce Makefile.in
-
- CC=$(CC_FOR_BUILD)
-+CFLAGS=
-+LDFLAGS=
- LIBTOOL = @LIBTOOL@ --tag=CC
-
- noinst_PROGRAMS = rpcgen
---
-1.7.9.5
-
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-debianize-start-statd.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-debianize-start-statd.patch
new file mode 100644
index 0000000000..ede0dcefc4
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-debianize-start-statd.patch
@@ -0,0 +1,42 @@
+[PATCH] nfs-utils: debianize start-statd
+
+Upstream-Status: Pending
+
+make start-statd command to use nfscommon configure, too.
+
+Signed-off-by: Henrik Riomar <henrik.riomar@ericsson.com>
+Signed-off-by: Li Wang <li.wang@windriver.com>
+Signed-off-by: Roy Li <rongqing.li@windriver.com>
+Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com>
+---
+ utils/statd/start-statd | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/utils/statd/start-statd b/utils/statd/start-statd
+index 2fd6039..f591b34 100755
+--- a/utils/statd/start-statd
++++ b/utils/statd/start-statd
+@@ -17,6 +17,14 @@ then
+ # statd already running - must have been slow to respond.
+ exit 0
+ fi
++
++# Read config
++DEFAULTFILE=/etc/default/nfs-common
++NEED_IDMAPD=
++if [ -f $DEFAULTFILE ]; then
++ . $DEFAULTFILE
++fi
++
+ # First try systemd if it's installed.
+ if [ -d /run/systemd/system ]; then
+ # Quit only if the call worked.
+@@ -25,4 +33,4 @@ fi
+
+ cd /
+ # Fall back to launching it ourselves.
+-exec rpc.statd --no-notify
++exec rpc.statd --no-notify $STATDOPTS
+--
+2.6.6
+
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-musl-res_querydomain.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-musl-res_querydomain.patch
new file mode 100644
index 0000000000..921f5edc82
--- /dev/null
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfs-utils-musl-res_querydomain.patch
@@ -0,0 +1,46 @@
+From caa19231196d73541445728e6813c8fa70345acb Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Tue, 26 Jun 2018 15:59:00 +0800
+Subject: [PATCH] nfs-utils: 2.1.1 -> 2.3.1
+
+Fixed:
+configure: error: res_querydomain needed
+
+Upstream-Status: Pending [https://github.com/alpinelinux/aports/blob/master/main/nfs-utils/musl-configure_ac.patch]
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+
+---
+ configure.ac | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 50002b4..dcadb23 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -582,10 +582,10 @@ my_am_cflags="\
+ -Wall \
+ -Wextra \
+ $rpcgen_cflags \
+- -Werror=missing-prototypes \
+- -Werror=missing-declarations \
++ -Wmissing-prototypes \
++ -Wmissing-declarations \
+ -Werror=format=2 \
+- -Werror=undef \
++ -Wundef \
+ -Werror=missing-include-dirs \
+ -Werror=strict-aliasing=2 \
+ -Werror=init-self \
+@@ -614,10 +614,9 @@ AC_DEFUN([CHECK_CCSUPPORT], [
+
+ CHECK_CCSUPPORT([-Werror=format-overflow=2], [flg1])
+ CHECK_CCSUPPORT([-Werror=int-conversion], [flg2])
+-CHECK_CCSUPPORT([-Werror=incompatible-pointer-types], [flg3])
+ CHECK_CCSUPPORT([-Werror=misleading-indentation], [flg4])
+
+-AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4"])
++AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg4"])
+
+ # Make sure that $ACLOCAL_FLAGS are used during a rebuild
+ AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"])
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
index 7ed93a59d4..0f5747cc6d 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/nfsserver
@@ -40,7 +40,7 @@ test "$NFS_SERVERS" != "" && test "$NFS_SERVERS" -gt 0 && test "$NFS_SERVERS" -l
#mountd
start_mountd(){
echo -n 'starting mountd: '
- start-stop-daemon --start --exec "$NFS_MOUNTD" -- "-f /etc/exports $@"
+ start-stop-daemon --start --exec "$NFS_MOUNTD" -- "$@"
echo done
}
stop_mountd(){
@@ -107,7 +107,7 @@ stop_nfsd(){
#FIXME: need to create the /var/lib/nfs/... directories
case "$1" in
start)
- exportfs -r
+ test -r /etc/exports && exportfs -r
start_nfsd "$NFS_SERVERS"
start_mountd
test -r /etc/exports && exportfs -a;;