diff options
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils/nfs-utils')
15 files changed, 739 insertions, 246 deletions
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..7603eb680d --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch @@ -0,0 +1,299 @@ +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 | 115 --------------------------------------------------------------------------------------------------------------- + support/misc/misc.c | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + support/nsm/Makefile.am | 2 +- + 4 files changed, 113 insertions(+), 117 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 06f6bb2..0000000 +--- a/support/misc/file.c ++++ /dev/null +@@ -1,115 +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/>. +- */ +- +-#ifdef HAVE_CONFIG_H +-#include <config.h> +-#endif +- +-#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-Replace-statfs64-with-statfs.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch new file mode 100644 index 0000000000..40ceff9ae9 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0001-Replace-statfs64-with-statfs.patch @@ -0,0 +1,171 @@ +From e89652b853ca7de671093ae44305fa3435e13d3d Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 15 Dec 2022 13:29:43 -0800 +Subject: [PATCH] Replace statfs64 with statfs + +autoconf AC_SYS_LARGEFILE is used by configure to add needed defines +when needed for enabling 64bit off_t, therefore replacing statfs64 with +statfs should be functionally same. Additionally this helps compiling +with latest musl where 64bit LFS functions like statfs64 and friends are +now moved under _LARGEFILE64_SOURCE feature test macro, this works on +glibc systems because _GNU_SOURCE macros also enables +_LARGEFILE64_SOURCE indirectly. This is not case with musl and this +latest issue is exposed. + +Upstream-Status: Submitted [https://lore.kernel.org/linux-nfs/20221215213605.4061853-1-raj.khem@gmail.com/T/#u] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + support/export/cache.c | 14 +++++++------- + support/include/nfsd_path.h | 6 +++--- + support/misc/nfsd_path.c | 24 ++++++++++++------------ + utils/exportfs/exportfs.c | 4 ++-- + 4 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/support/export/cache.c b/support/export/cache.c +index a5823e9..2497d4f 100644 +--- a/support/export/cache.c ++++ b/support/export/cache.c +@@ -346,27 +346,27 @@ static int uuid_by_path(char *path, int type, size_t uuidlen, char *uuid) + + /* Possible sources of uuid are + * - blkid uuid +- * - statfs64 uuid ++ * - statfs uuid + * +- * On some filesystems (e.g. vfat) the statfs64 uuid is simply an ++ * On some filesystems (e.g. vfat) the statfs uuid is simply an + * encoding of the device that the filesystem is mounted from, so + * it we be very bad to use that (as device numbers change). blkid + * must be preferred. +- * On other filesystems (e.g. btrfs) the statfs64 uuid contains ++ * On other filesystems (e.g. btrfs) the statfs uuid contains + * important info that the blkid uuid cannot contain: This happens + * when multiple subvolumes are exported (they have the same +- * blkid uuid but different statfs64 uuids). ++ * blkid uuid but different statfs uuids). + * We rely on get_uuid_blkdev *knowing* which is which and not returning +- * a uuid for filesystems where the statfs64 uuid is better. ++ * a uuid for filesystems where the statfs uuid is better. + * + */ +- struct statfs64 st; ++ struct statfs st; + char fsid_val[17]; + const char *blkid_val = NULL; + const char *val; + int rc; + +- rc = nfsd_path_statfs64(path, &st); ++ rc = nfsd_path_statfs(path, &st); + + if (type == 0 && rc == 0) { + const unsigned long *bad; +diff --git a/support/include/nfsd_path.h b/support/include/nfsd_path.h +index 3b73aad..aa1e1dd 100644 +--- a/support/include/nfsd_path.h ++++ b/support/include/nfsd_path.h +@@ -7,7 +7,7 @@ + #include <sys/stat.h> + + struct file_handle; +-struct statfs64; ++struct statfs; + + void nfsd_path_init(void); + +@@ -18,8 +18,8 @@ char * nfsd_path_prepend_dir(const char *dir, const char *pathname); + int nfsd_path_stat(const char *pathname, struct stat *statbuf); + int nfsd_path_lstat(const char *pathname, struct stat *statbuf); + +-int nfsd_path_statfs64(const char *pathname, +- struct statfs64 *statbuf); ++int nfsd_path_statfs(const char *pathname, ++ struct statfs *statbuf); + + char * nfsd_realpath(const char *path, char *resolved_path); + +diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c +index 65e53c1..c3dea4f 100644 +--- a/support/misc/nfsd_path.c ++++ b/support/misc/nfsd_path.c +@@ -184,46 +184,46 @@ nfsd_path_lstat(const char *pathname, struct stat *statbuf) + return nfsd_run_stat(nfsd_wq, nfsd_lstatfunc, pathname, statbuf); + } + +-struct nfsd_statfs64_data { ++struct nfsd_statfs_data { + const char *pathname; +- struct statfs64 *statbuf; ++ struct statfs *statbuf; + int ret; + int err; + }; + + static void +-nfsd_statfs64func(void *data) ++nfsd_statfsfunc(void *data) + { +- struct nfsd_statfs64_data *d = data; ++ struct nfsd_statfs_data *d = data; + +- d->ret = statfs64(d->pathname, d->statbuf); ++ d->ret = statfs(d->pathname, d->statbuf); + if (d->ret < 0) + d->err = errno; + } + + static int +-nfsd_run_statfs64(struct xthread_workqueue *wq, ++nfsd_run_statfs(struct xthread_workqueue *wq, + const char *pathname, +- struct statfs64 *statbuf) ++ struct statfs *statbuf) + { +- struct nfsd_statfs64_data data = { ++ struct nfsd_statfs_data data = { + pathname, + statbuf, + 0, + 0 + }; +- xthread_work_run_sync(wq, nfsd_statfs64func, &data); ++ xthread_work_run_sync(wq, nfsd_statfsfunc, &data); + if (data.ret < 0) + errno = data.err; + return data.ret; + } + + int +-nfsd_path_statfs64(const char *pathname, struct statfs64 *statbuf) ++nfsd_path_statfs(const char *pathname, struct statfs *statbuf) + { + if (!nfsd_wq) +- return statfs64(pathname, statbuf); +- return nfsd_run_statfs64(nfsd_wq, pathname, statbuf); ++ return statfs(pathname, statbuf); ++ return nfsd_run_statfs(nfsd_wq, pathname, statbuf); + } + + struct nfsd_realpath_data { +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index 0897b22..6d79a5b 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -513,7 +513,7 @@ validate_export(nfs_export *exp) + */ + struct stat stb; + char *path = exportent_realpath(&exp->m_export); +- struct statfs64 stf; ++ struct statfs stf; + int fs_has_fsid = 0; + + if (stat(path, &stb) < 0) { +@@ -528,7 +528,7 @@ validate_export(nfs_export *exp) + if (!can_test()) + return; + +- if (!statfs64(path, &stf) && ++ if (!statfs(path, &stf) && + (stf.f_fsid.__val[0] || stf.f_fsid.__val[1])) + fs_has_fsid = 1; + 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-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/0005-mountd-Check-for-return-of-stat-function.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0005-mountd-Check-for-return-of-stat-function.patch new file mode 100644 index 0000000000..13a21e5307 --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0005-mountd-Check-for-return-of-stat-function.patch @@ -0,0 +1,34 @@ +From 887ecc7837962e9be77a4fea7d9122648f73a84a Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 15 Aug 2022 14:47:53 -0700 +Subject: [PATCH] mountd: Check for return of stat function + +simplify the check, stat() return 0 on success -1 on failure + +Fixes clang reported errors e.g. + +| v4clients.c:29:6: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses] +| if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || +| ^ ~~ + +Upstream-Status: Submitted [https://patchwork.kernel.org/project/linux-nfs/patch/20220816024403.2694169-1-raj.khem@gmail.com/] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +Cc: Konstantin Khorenko <khorenko@virtuozzo.com> +Cc: Steve Dickson <steved@redhat.com> +--- + support/export/v4clients.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/support/export/v4clients.c b/support/export/v4clients.c +index 5f15b61..3230251 100644 +--- a/support/export/v4clients.c ++++ b/support/export/v4clients.c +@@ -26,7 +26,7 @@ void v4clients_init(void) + { + struct stat sb; + +- if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || ++ if (stat("/proc/fs/nfsd/clients", &sb) != 0 || + !S_ISDIR(sb.st_mode)) + return; + if (clients_fd >= 0) diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils/0006-Fix-function-prototypes.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/0006-Fix-function-prototypes.patch new file mode 100644 index 0000000000..793bc4651c --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/0006-Fix-function-prototypes.patch @@ -0,0 +1,93 @@ +From cf0ffbb5c8fa167376926d12a63613f15aa7602f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Mon, 15 Aug 2022 14:50:15 -0700 +Subject: [PATCH] Fix function prototypes + +Clang is now erroring out on functions with out parameter types + +Fixes errors like +error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] + +Upstream-Status: Submitted [https://patchwork.kernel.org/project/linux-nfs/patch/20220816024403.2694169-2-raj.khem@gmail.com/] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + support/export/auth.c | 2 +- + support/export/v4root.c | 2 +- + support/export/xtab.c | 2 +- + utils/exportfs/exportfs.c | 4 ++-- + utils/mount/network.c | 2 +- + 5 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/support/export/auth.c b/support/export/auth.c +index 03ce4b8..2d7960f 100644 +--- a/support/export/auth.c ++++ b/support/export/auth.c +@@ -82,7 +82,7 @@ check_useipaddr(void) + } + + unsigned int +-auth_reload() ++auth_reload(void) + { + struct stat stb; + static ino_t last_inode; +diff --git a/support/export/v4root.c b/support/export/v4root.c +index c12a7d8..fbb0ad5 100644 +--- a/support/export/v4root.c ++++ b/support/export/v4root.c +@@ -198,7 +198,7 @@ static int v4root_add_parents(nfs_export *exp) + * looking for components of the v4 mount. + */ + void +-v4root_set() ++v4root_set(void) + { + nfs_export *exp; + int i; +diff --git a/support/export/xtab.c b/support/export/xtab.c +index c888a80..e210ca9 100644 +--- a/support/export/xtab.c ++++ b/support/export/xtab.c +@@ -135,7 +135,7 @@ xtab_write(char *xtab, char *xtabtmp, char *lockfn, int is_export) + } + + int +-xtab_export_write() ++xtab_export_write(void) + { + return xtab_write(etab.statefn, etab.tmpfn, etab.lockfn, 1); + } +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index 6ba615d..0897b22 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -69,14 +69,14 @@ static int _lockfd = -1; + * need these additional lockfile() routines. + */ + static void +-grab_lockfile() ++grab_lockfile(void) + { + _lockfd = open(lockfile, O_CREAT|O_RDWR, 0666); + if (_lockfd != -1) + lockf(_lockfd, F_LOCK, 0); + } + static void +-release_lockfile() ++release_lockfile(void) + { + if (_lockfd != -1) { + lockf(_lockfd, F_ULOCK, 0); +diff --git a/utils/mount/network.c b/utils/mount/network.c +index ed2f825..01ead49 100644 +--- a/utils/mount/network.c ++++ b/utils/mount/network.c +@@ -179,7 +179,7 @@ static const unsigned long probe_mnt3_only[] = { + + static const unsigned int *nfs_default_proto(void); + #ifdef MOUNT_CONFIG +-static const unsigned int *nfs_default_proto() ++static const unsigned int *nfs_default_proto(void) + { + extern unsigned long config_default_proto; + /* 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-warnings.patch b/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch new file mode 100644 index 0000000000..fde99b599e --- /dev/null +++ b/meta/recipes-connectivity/nfs-utils/nfs-utils/clang-warnings.patch @@ -0,0 +1,36 @@ +From 1ab0c326405c6daa06f1a7eb4b0b60bf4e0584c2 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Tue, 31 Dec 2019 08:15:34 -0800 +Subject: [PATCH] Detect warning options during configure + +Certain options maybe compiler specific therefore its better +to detect them before use. + +nfs_error copies the format string and appends newline to it +but compiler can forget that it was format string since its not +same fmt string that was passed. Ignore the warning + +Wdiscarded-qualifiers is gcc specific and this is no longer needed + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> + +--- + support/nfs/xcommon.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c +index 3989f0b..e080423 100644 +--- a/support/nfs/xcommon.c ++++ b/support/nfs/xcommon.c +@@ -98,7 +98,10 @@ nfs_error (const char *fmt, ...) { + + fmt2 = xstrconcat2 (fmt, "\n"); + va_start (args, fmt); ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wformat-nonliteral" + vfprintf (stderr, fmt2, args); ++#pragma GCC diagnostic pop + va_end (args); + free (fmt2); + } 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..5c845b7e82 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,9 +14,9 @@ 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 RemainAfterExit=yes [Install] 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/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;; |