summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/nfs-utils
diff options
context:
space:
mode:
authorYi Zhao <yi.zhao@windriver.com>2019-09-12 11:28:24 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-09-16 23:02:44 +0100
commit100bf17470211abd499a3b8700b2d0c221b2d3ea (patch)
tree0cbb29a7de20f74f001191ce1ee3d997fed0768b /meta/recipes-connectivity/nfs-utils
parent631f3dc9be6c333c50c62350844c01c5538a1693 (diff)
downloadpoky-100bf17470211abd499a3b8700b2d0c221b2d3ea.tar.gz
nfs-utils: fix nfs mount error on 32bit nfs server
There is a client side error "Stale file handle" when mounting from a nfs server running on 32bit arch. Steps to reproduce: 1. $ MACHINE=qemux86 bitbake core-image-sato 2. $ runqemu qemux86 kvm nographic qemuparams="-m 1024" 3. $ echo "/nfs_root *(insecure,rw,async,no_root_squash,no_subtree_check)" \ >> /etc/exports $ /etc/init.d/nfsserver restart root@qemux86:~# mount -t nfs 127.0.0.1:/nfs_root /mnt mount: mounting 127.0.0.1:/nfs_root on /mnt failed: Stale file handle Backport a patch to fix this issue. (From OE-Core rev: 727e6ce1f904abf1a1059fde759c3aaea37de199) Signed-off-by: Yi Zhao <yi.zhao@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-connectivity/nfs-utils')
-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_2.4.1.bb1
2 files changed, 157 insertions, 0 deletions
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 @@
1From 2fbc62e2a13fc22b6ae4910e295a2c10fb790486 Mon Sep 17 00:00:00 2001
2From: Zoltan Karcagi <zkr7432@gmail.com>
3Date: Mon, 12 Aug 2019 13:27:16 -0400
4Subject: [PATCH] Fix include order between config.h and stat.h
5
6At least on Arch linux ARM, the definition of struct stat in stat.h depends
7on __USE_FILE_OFFSET64. This symbol comes from config.h when defined,
8therefore config.h must always be included before stat.h. Fix all
9occurrences where the order is wrong by moving config.h to the top.
10
11This fixes the client side error "Stale file handle" when mounting from
12a server running Arch Linux ARM.
13
14Signed-off-by: Zoltan Karcagi <zkr7432@gmail.com>
15Signed-off-by: Steve Dickson <steved@redhat.com>
16
17Upstream-Status: Backport
18[http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=2fbc62e2a13fc22b6ae4910e295a2c10fb790486]
19
20Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
21---
22 support/misc/nfsd_path.c | 5 ++++-
23 support/misc/xstat.c | 5 ++++-
24 support/nfs/conffile.c | 8 +++++++-
25 utils/blkmapd/device-discovery.c | 8 ++++----
26 utils/idmapd/idmapd.c | 8 ++++----
27 5 files changed, 23 insertions(+), 11 deletions(-)
28
29diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c
30index 84e4802..f078a66 100644
31--- a/support/misc/nfsd_path.c
32+++ b/support/misc/nfsd_path.c
33@@ -1,3 +1,7 @@
34+#ifdef HAVE_CONFIG_H
35+#include <config.h>
36+#endif
37+
38 #include <errno.h>
39 #include <sys/types.h>
40 #include <sys/stat.h>
41@@ -5,7 +9,6 @@
42 #include <stdlib.h>
43 #include <unistd.h>
44
45-#include "config.h"
46 #include "conffile.h"
47 #include "xmalloc.h"
48 #include "xlog.h"
49diff --git a/support/misc/xstat.c b/support/misc/xstat.c
50index fa04788..4c997ee 100644
51--- a/support/misc/xstat.c
52+++ b/support/misc/xstat.c
53@@ -1,3 +1,7 @@
54+#ifdef HAVE_CONFIG_H
55+#include <config.h>
56+#endif
57+
58 #include <errno.h>
59 #include <sys/types.h>
60 #include <fcntl.h>
61@@ -5,7 +9,6 @@
62 #include <sys/sysmacros.h>
63 #include <unistd.h>
64
65-#include "config.h"
66 #include "xstat.h"
67
68 #ifdef HAVE_FSTATAT
69diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
70index b6400be..6ba8a35 100644
71--- a/support/nfs/conffile.c
72+++ b/support/nfs/conffile.c
73@@ -500,7 +500,7 @@ conf_readfile(const char *path)
74
75 if ((stat (path, &sb) == 0) || (errno != ENOENT)) {
76 char *new_conf_addr = NULL;
77- size_t sz = sb.st_size;
78+ off_t sz;
79 int fd = open (path, O_RDONLY, 0);
80
81 if (fd == -1) {
82@@ -517,6 +517,11 @@ conf_readfile(const char *path)
83
84 /* only after we have the lock, check the file size ready to read it */
85 sz = lseek(fd, 0, SEEK_END);
86+ if (sz < 0) {
87+ xlog_warn("conf_readfile: unable to determine file size: %s",
88+ strerror(errno));
89+ goto fail;
90+ }
91 lseek(fd, 0, SEEK_SET);
92
93 new_conf_addr = malloc(sz+1);
94@@ -2162,6 +2167,7 @@ conf_write(const char *filename, const char *section, const char *arg,
95 ret = 0;
96
97 cleanup:
98+ flush_outqueue(&inqueue, NULL);
99 flush_outqueue(&outqueue, NULL);
100
101 if (buff)
102diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
103index e811703..f5f9b10 100644
104--- a/utils/blkmapd/device-discovery.c
105+++ b/utils/blkmapd/device-discovery.c
106@@ -26,6 +26,10 @@
107 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
108 */
109
110+#ifdef HAVE_CONFIG_H
111+#include "config.h"
112+#endif /* HAVE_CONFIG_H */
113+
114 #include <sys/sysmacros.h>
115 #include <sys/types.h>
116 #include <sys/stat.h>
117@@ -51,10 +55,6 @@
118 #include <errno.h>
119 #include <libdevmapper.h>
120
121-#ifdef HAVE_CONFIG_H
122-#include "config.h"
123-#endif /* HAVE_CONFIG_H */
124-
125 #include "device-discovery.h"
126 #include "xcommon.h"
127 #include "nfslib.h"
128diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
129index 62e37b8..267acea 100644
130--- a/utils/idmapd/idmapd.c
131+++ b/utils/idmapd/idmapd.c
132@@ -34,6 +34,10 @@
133 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
134 */
135
136+#ifdef HAVE_CONFIG_H
137+#include "config.h"
138+#endif /* HAVE_CONFIG_H */
139+
140 #include <sys/types.h>
141 #include <sys/time.h>
142 #include <sys/inotify.h>
143@@ -62,10 +66,6 @@
144 #include <libgen.h>
145 #include <nfsidmap.h>
146
147-#ifdef HAVE_CONFIG_H
148-#include "config.h"
149-#endif /* HAVE_CONFIG_H */
150-
151 #include "xlog.h"
152 #include "conffile.h"
153 #include "queue.h"
154--
1552.7.4
156
diff --git a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.4.1.bb b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.4.1.bb
index 8b673c8f5f..7e80354e4e 100644
--- a/meta/recipes-connectivity/nfs-utils/nfs-utils_2.4.1.bb
+++ b/meta/recipes-connectivity/nfs-utils/nfs-utils_2.4.1.bb
@@ -32,6 +32,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/nfs-utils/${PV}/nfs-utils-${PV}.tar.x
32 file://clang-format-string.patch \ 32 file://clang-format-string.patch \
33 file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \ 33 file://0001-Makefile.am-fix-undefined-function-for-libnsm.a.patch \
34 file://0001-Don-t-build-tools-with-CC_FOR_BUILD.patch \ 34 file://0001-Don-t-build-tools-with-CC_FOR_BUILD.patch \
35 file://0001-Fix-include-order-between-config.h-and-stat.h.patch \
35" 36"
36SRC_URI_append_libc-glibc = " file://0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch" 37SRC_URI_append_libc-glibc = " file://0001-configure.ac-Do-not-fatalize-Wmissing-prototypes.patch"
37SRC_URI_append_libc-musl = " file://nfs-utils-musl-res_querydomain.patch" 38SRC_URI_append_libc-musl = " file://nfs-utils-musl-res_querydomain.patch"