diff --git a/1001-nfs-utils-gcc10.patch b/1001-nfs-utils-gcc10.patch new file mode 100644 index 0000000000000000000000000000000000000000..e385d28a09d5b5e8413a06ee5cae11adfe4b68ba --- /dev/null +++ b/1001-nfs-utils-gcc10.patch @@ -0,0 +1,69 @@ +From 1eafe05616b4660fb15d106e06f0b3e18983708c Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Fri, 7 Feb 2020 11:05:03 -0500 +Subject: [PATCH] Allow compilation to succeed with -fno-common + +When compiled with -fno-common, global variables that are declared +multple times cause an error. With -fcommon (the default), they are +merged. + +Declaring such variable multiple times is probably not a good idea, and +is definitely not necessary. + +This patch changes all the global variables defined in include files to +be explicitly "extern", and where necessary, adds the variable +declaration to a suitable .c file. + +To test, run + CFLAGS=-fno-common ./configure + make + +Signed-off-by: NeilBrown +Signed-off-by: Steve Dickson +--- + utils/mountd/v4root.c | 2 -- + utils/statd/statd.c | 1 + + utils/statd/statd.h | 2 +- + 5 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/utils/mountd/v4root.c b/utils/mountd/v4root.c +index d735dbf..dd9828e 100644 +--- a/utils/mountd/v4root.c ++++ b/utils/mountd/v4root.c +@@ -28,8 +28,6 @@ + #include "v4root.h" + #include "pseudoflavors.h" + +-int v4root_needed; +- + static nfs_export pseudo_root = { + .m_next = NULL, + .m_client = NULL, +diff --git a/utils/statd/statd.c b/utils/statd/statd.c +index 8eef2ff..e4a1df4 100644 +--- a/utils/statd/statd.c ++++ b/utils/statd/statd.c +@@ -67,6 +67,7 @@ static struct option longopts[] = + }; + + extern void sm_prog_1 (struct svc_req *, register SVCXPRT *); ++stat_chge SM_stat_chge; + + #ifdef SIMULATIONS + extern void simulator (int, char **); +diff --git a/utils/statd/statd.h b/utils/statd/statd.h +index 231ac7e..bb1fecb 100644 +--- a/utils/statd/statd.h ++++ b/utils/statd/statd.h +@@ -41,7 +41,7 @@ extern void load_state(void); + /* + * Host status structure and macros. + */ +-stat_chge SM_stat_chge; ++extern stat_chge SM_stat_chge; + #define MY_NAME SM_stat_chge.mon_name + #define MY_STATE SM_stat_chge.state + +-- +1.8.3.1 + diff --git a/1002-Allow-compilation-to-succeed-with-fno-common.patch b/1002-Allow-compilation-to-succeed-with-fno-common.patch new file mode 100644 index 0000000000000000000000000000000000000000..0d1973f279726fc59b7fe05af5c2503ee55d5c8f --- /dev/null +++ b/1002-Allow-compilation-to-succeed-with-fno-common.patch @@ -0,0 +1,70 @@ +From 1eafe05616b4660fb15d106e06f0b3e18983708c Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Fri, 7 Feb 2020 11:05:03 -0500 +Subject: [PATCH] Allow compilation to succeed with -fno-common + +When compiled with -fno-common, global variables that are declared +multple times cause an error. With -fcommon (the default), they are +merged. + +Declaring such variable multiple times is probably not a good idea, and +is definitely not necessary. + +This patch changes all the global variables defined in include files to +be explicitly "extern", and where necessary, adds the variable +declaration to a suitable .c file. + +To test, run + CFLAGS=-fno-common ./configure + make + +Signed-off-by: NeilBrown +Signed-off-by: Steve Dickson +--- + utils/mountd/v4root.c | 2 -- + utils/nfsdcld/cld-internal.h | 10 +++++----- + utils/nfsdcld/nfsdcld.c | 6 ++++++ + utils/statd/statd.c | 1 + + utils/statd/statd.h | 2 +- + 5 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/utils/nfsdcld/cld-internal.h b/utils/nfsdcld/cld-internal.h +index 05f01be..cc283da 100644 +--- a/utils/nfsdcld/cld-internal.h ++++ b/utils/nfsdcld/cld-internal.h +@@ -35,10 +35,10 @@ struct cld_client { + } cl_u; + }; + +-uint64_t current_epoch; +-uint64_t recovery_epoch; +-int first_time; +-int num_cltrack_records; +-int num_legacy_records; ++extern uint64_t current_epoch; ++extern uint64_t recovery_epoch; ++extern int first_time; ++extern int num_cltrack_records; ++extern int num_legacy_records; + + #endif /* _CLD_INTERNAL_H_ */ +diff --git a/utils/nfsdcld/nfsdcld.c b/utils/nfsdcld/nfsdcld.c +index 2ad1001..be65562 100644 +--- a/utils/nfsdcld/nfsdcld.c ++++ b/utils/nfsdcld/nfsdcld.c +@@ -69,6 +69,12 @@ static int inotify_fd = -1; + static struct event pipedir_event; + static bool old_kernel = false; + ++uint64_t current_epoch; ++uint64_t recovery_epoch; ++int first_time; ++int num_cltrack_records; ++int num_legacy_records; ++ + static struct option longopts[] = + { + { "help", 0, NULL, 'h' }, +-- +1.8.3.1 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 345fa9fce64137968eb3212fefd01083a31d2fab..378b02bf35c0efde7b49e38a7cd786b904ba1e87 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -1,8 +1,9 @@ +%define anolis_release .0.1 Summary: NFS utilities and supporting clients and daemons for the kernel NFS server Name: nfs-utils URL: http://linux-nfs.org/ Version: 2.3.3 -Release: 46%{?dist} +Release: 46%{anolis_release}%{?dist} Epoch: 1 # group all 32bit related archs @@ -92,6 +93,12 @@ Patch102: nfs-utils-2.3.3-idmap-errmsg.patch Patch103: nfs-utils-2.3.1-systemd-gssproxy-restart.patch Patch104: nfs-utils-2.3.1-systemd-svcgssd-removed.patch +# Begin: Anolis customized patches +Patch1001: 1001-nfs-utils-gcc10.patch +# backport patch from upstream +Patch1002: 1002-Allow-compilation-to-succeed-with-fno-common.patch +# End: Anolis customized patches + Provides: exportfs = %{epoch}:%{version}-%{release} Provides: nfsstat = %{epoch}:%{version}-%{release} Provides: showmount = %{epoch}:%{version}-%{release} @@ -360,6 +367,10 @@ fi %{_libdir}/libnfsidmap.so %changelog +* Thu Jan 20 2022 Weitao Zhou 2.3.3-46.0.1 +- use extern in header files when declaring global variables for compatible gcc10 build +- allow compilation to succeed with -fno-common + * Wed Jul 28 2021 Steve Dickson 2.3.3-46 - mount.nfs: Fix the sloppy option processing (bz 1967883)