1 From 2fbc62e2a13fc22b6ae4910e295a2c10fb790486 Mon Sep 17 00:00:00 2001
2 From: Zoltan Karcagi <zkr7432@gmail.com>
3 Date: Mon, 12 Aug 2019 13:27:16 -0400
4 Subject: [PATCH] Fix include order between config.h and stat.h
6 At least on Arch linux ARM, the definition of struct stat in stat.h depends
7 on __USE_FILE_OFFSET64. This symbol comes from config.h when defined,
8 therefore config.h must always be included before stat.h. Fix all
9 occurrences where the order is wrong by moving config.h to the top.
11 This fixes the client side error "Stale file handle" when mounting from
12 a server running Arch Linux ARM.
14 Signed-off-by: Zoltan Karcagi <zkr7432@gmail.com>
15 Signed-off-by: Steve Dickson <steved@redhat.com>
17 Upstream-Status: Backport
18 [http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=2fbc62e2a13fc22b6ae4910e295a2c10fb790486]
20 Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
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(-)
29 diff --git a/support/misc/nfsd_path.c b/support/misc/nfsd_path.c
30 index 84e4802..f078a66 100644
31 --- a/support/misc/nfsd_path.c
32 +++ b/support/misc/nfsd_path.c
39 #include <sys/types.h>
49 diff --git a/support/misc/xstat.c b/support/misc/xstat.c
50 index fa04788..4c997ee 100644
51 --- a/support/misc/xstat.c
52 +++ b/support/misc/xstat.c
59 #include <sys/types.h>
62 #include <sys/sysmacros.h>
69 diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
70 index 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)
75 if ((stat (path, &sb) == 0) || (errno != ENOENT)) {
76 char *new_conf_addr = NULL;
77 - size_t sz = sb.st_size;
79 int fd = open (path, O_RDONLY, 0);
82 @@ -517,6 +517,11 @@ conf_readfile(const char *path)
84 /* only after we have the lock, check the file size ready to read it */
85 sz = lseek(fd, 0, SEEK_END);
87 + xlog_warn("conf_readfile: unable to determine file size: %s",
91 lseek(fd, 0, SEEK_SET);
93 new_conf_addr = malloc(sz+1);
94 @@ -2162,6 +2167,7 @@ conf_write(const char *filename, const char *section, const char *arg,
98 + flush_outqueue(&inqueue, NULL);
99 flush_outqueue(&outqueue, NULL);
102 diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
103 index e811703..f5f9b10 100644
104 --- a/utils/blkmapd/device-discovery.c
105 +++ b/utils/blkmapd/device-discovery.c
107 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
110 +#ifdef HAVE_CONFIG_H
112 +#endif /* HAVE_CONFIG_H */
114 #include <sys/sysmacros.h>
115 #include <sys/types.h>
116 #include <sys/stat.h>
119 #include <libdevmapper.h>
121 -#ifdef HAVE_CONFIG_H
123 -#endif /* HAVE_CONFIG_H */
125 #include "device-discovery.h"
128 diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c
129 index 62e37b8..267acea 100644
130 --- a/utils/idmapd/idmapd.c
131 +++ b/utils/idmapd/idmapd.c
133 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
136 +#ifdef HAVE_CONFIG_H
138 +#endif /* HAVE_CONFIG_H */
140 #include <sys/types.h>
141 #include <sys/time.h>
142 #include <sys/inotify.h>
145 #include <nfsidmap.h>
147 -#ifdef HAVE_CONFIG_H
149 -#endif /* HAVE_CONFIG_H */
152 #include "conffile.h"