From 188131852795249d2fe5acd136778acdf56f9d4d Mon Sep 17 00:00:00 2001 From: Jacob Wang Date: Mon, 15 Sep 2025 13:32:15 +0800 Subject: [PATCH 1/8] [BUG]update to nfs-utils-2.3.3-64 to #ICXZ6L update to nfs-utils-2.3.3-64 for bugfix Signed-off-by: Jacob Wang --- 0001-nfs-disable-v4client-for-loongarch.patch | 27 -- 1001-nfs-utils-gcc10.patch | 68 ----- ...mpilation-to-succeed-with-fno-common.patch | 66 ----- dist | 2 +- ...3-gssd-do-not-use-krb5_cc_initialize.patch | 208 +++++++++++++++ ....3.3-gssd-man-document-use-gss-proxy.patch | 47 ++++ ...ally-use-krb5_get_init_creds_opt_all.patch | 98 +++++++ nfs-utils-2.3.3-mountstats-fixes.patch | 141 ++++++++++ nfs-utils-2.3.3-nfs-man-rdirplus.patch | 47 ++++ nfs-utils-2.3.3-nfsiostat-fixes.patch | 242 ++++++++++++++++++ ...-carefully-detect-of-res_querydomain.patch | 41 --- ...ix-NFSv4-export-of-tmpfs-filesystems.patch | 223 ---------------- ...ion-of-etab-and-rmtab-into-libraries.patch | 138 ---------- ....4-Remove-force-arg-from-cache_flush.patch | 136 ---------- nfs-utils.spec | 101 +++----- 15 files changed, 817 insertions(+), 768 deletions(-) delete mode 100644 0001-nfs-disable-v4client-for-loongarch.patch delete mode 100644 1001-nfs-utils-gcc10.patch delete mode 100644 1002-Allow-compilation-to-succeed-with-fno-common.patch create mode 100644 nfs-utils-2.3.3-gssd-do-not-use-krb5_cc_initialize.patch create mode 100644 nfs-utils-2.3.3-gssd-man-document-use-gss-proxy.patch create mode 100644 nfs-utils-2.3.3-gssd-unconditionally-use-krb5_get_init_creds_opt_all.patch create mode 100644 nfs-utils-2.3.3-mountstats-fixes.patch create mode 100644 nfs-utils-2.3.3-nfs-man-rdirplus.patch create mode 100644 nfs-utils-2.3.3-nfsiostat-fixes.patch delete mode 100644 nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch delete mode 100644 nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch delete mode 100644 nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch delete mode 100644 nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch diff --git a/0001-nfs-disable-v4client-for-loongarch.patch b/0001-nfs-disable-v4client-for-loongarch.patch deleted file mode 100644 index 4f2c013..0000000 --- a/0001-nfs-disable-v4client-for-loongarch.patch +++ /dev/null @@ -1,27 +0,0 @@ -From f0545ed4469160964d4c2755bda71194423ca9c5 Mon Sep 17 00:00:00 2001 -From: Liwei Ge -Date: Thu, 2 Mar 2023 13:49:23 +0800 -Subject: [PATCH] nfs: disable v4client for loongarch - -Signed-off-by: Bo Ren ---- - support/export/v4clients.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/support/export/v4clients.c b/support/export/v4clients.c -index 6451a16..c6c73a8 100644 ---- a/support/export/v4clients.c -+++ b/support/export/v4clients.c -@@ -25,6 +25,9 @@ static int clients_fd = -1; - void v4clients_init(void) - { - struct stat sb; -+ #ifdef __loongarch__ -+ return; -+ #endif - - if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || - !S_ISDIR(sb.st_mode)) --- -2.27.0 - diff --git a/1001-nfs-utils-gcc10.patch b/1001-nfs-utils-gcc10.patch deleted file mode 100644 index 609b063..0000000 --- a/1001-nfs-utils-gcc10.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 80a9ea81f54fb6bd2147fa247cb06515990deb19 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Tue, 26 Apr 2022 16:53:23 +0800 -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 ---- - support/export/v4root.c | 2 -- - utils/statd/statd.c | 2 ++ - utils/statd/statd.h | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/support/export/v4root.c b/support/export/v4root.c -index 4d33117..3654bd7 100644 ---- a/support/export/v4root.c -+++ b/support/export/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..665b0fe 100644 ---- a/utils/statd/statd.c -+++ b/utils/statd/statd.c -@@ -68,6 +68,8 @@ 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 **); - #endif -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 - --- -2.18.4 - diff --git a/1002-Allow-compilation-to-succeed-with-fno-common.patch b/1002-Allow-compilation-to-succeed-with-fno-common.patch deleted file mode 100644 index a9c7dc9..0000000 --- a/1002-Allow-compilation-to-succeed-with-fno-common.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 050d33d0c81fe82d004fe75b25415232e110756e Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Tue, 26 Apr 2022 17:02:57 +0800 -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/nfsdcld/cld-internal.h | 11 +++++------ - utils/nfsdcld/nfsdcld.c | 6 ++++++ - 2 files changed, 11 insertions(+), 6 deletions(-) - -diff --git a/utils/nfsdcld/cld-internal.h b/utils/nfsdcld/cld-internal.h -index 05f01be..e8216c9 100644 ---- a/utils/nfsdcld/cld-internal.h -+++ b/utils/nfsdcld/cld-internal.h -@@ -35,10 +35,9 @@ 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' }, --- -2.18.4 - diff --git a/dist b/dist index 9c0e36e..1fe92cf 100644 --- a/dist +++ b/dist @@ -1 +1 @@ -an8 +an8_10 diff --git a/nfs-utils-2.3.3-gssd-do-not-use-krb5_cc_initialize.patch b/nfs-utils-2.3.3-gssd-do-not-use-krb5_cc_initialize.patch new file mode 100644 index 0000000..2a7d217 --- /dev/null +++ b/nfs-utils-2.3.3-gssd-do-not-use-krb5_cc_initialize.patch @@ -0,0 +1,208 @@ +From ad4eafccd244e87af315c432d076b4f988dde52a Mon Sep 17 00:00:00 2001 +From: Olga Kornievskaia +Date: Mon, 24 Mar 2025 08:43:43 -0400 +Subject: [PATCH 2/2] gssd: do not use krb5_cc_initialize + +Note: This patch differs from the upstream version in several places +because RHEL 8 does not have c8659457 ("gssd: We never use the nocache +param of gssd_check_if_cc_exists()") or f066f87b ("gssd: enable forcing +cred renewal using the keytab"). + +Original commit message: + +When gssd refreshes machine credentials, it uses the +krb5_get_init_creds_keytab() and then to save the received credentials +in a ticket cache, it proceeds to initialize the credential cache via +a krb5_cc_initialize() before storing the received credentials into it. + +krb5_cc_initialize() is not concurrency safe. two gssd upcalls by +uid=0, one for krb5i auth flavor and another for krb5p, would enter +into krb5_cc_initialize() and one of them would fail, leading to +an upcall failure and NFS operation error. + +Instead it was proposed that gssd changes its design to do what +kinit does and forgo the use of krb5_cc_initialize and instead setup +the output cache via krb5_get_init_creds_opt_set_out_cache() prior +to calling krb5_get_init_creds_keytab() which would then store +credentials automatically. + +https://mailman.mit.edu/pipermail/krbdev/2025-February/013708.html + +Signed-off-by: Olga Kornievskaia +Signed-off-by: Steve Dickson +(cherry picked from commit 1cd9e3c0d290646e80750249914396566dd6b800) +Signed-off-by: Scott Mayhew +--- + utils/gssd/krb5_util.c | 103 ++++++++++++++++++++--------------------- + 1 file changed, 50 insertions(+), 53 deletions(-) + +diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c +index 871add74..43bc8744 100644 +--- a/utils/gssd/krb5_util.c ++++ b/utils/gssd/krb5_util.c +@@ -161,7 +161,8 @@ static int select_krb5_ccache(const struct dirent *d); + static int gssd_find_existing_krb5_ccache(uid_t uid, char *dirname, + const char **cctype, struct dirent **d); + static int gssd_get_single_krb5_cred(krb5_context context, +- krb5_keytab kt, struct gssd_k5_kt_princ *ple, int nocache); ++ krb5_keytab kt, struct gssd_k5_kt_princ *ple, int nocache, ++ krb5_ccache ccache); + static int query_krb5_ccache(const char* cred_cache, char **ret_princname, + char **ret_realm); + +@@ -368,16 +369,14 @@ static int + gssd_get_single_krb5_cred(krb5_context context, + krb5_keytab kt, + struct gssd_k5_kt_princ *ple, +- int nocache) ++ int nocache, ++ krb5_ccache ccache) + { + krb5_get_init_creds_opt *opts = NULL; + krb5_creds my_creds; +- krb5_ccache ccache = NULL; + char kt_name[BUFSIZ]; +- char cc_name[BUFSIZ]; + int code; + time_t now = time(0); +- char *cache_type; + char *pname = NULL; + char *k5err = NULL; + pthread_t tid = pthread_self(); +@@ -427,6 +426,14 @@ gssd_get_single_krb5_cred(krb5_context context, + krb5_get_init_creds_opt_set_tkt_life(opts, 5*60); + #endif + ++ if ((code = krb5_get_init_creds_opt_set_out_ccache(context, opts, ++ ccache))) { ++ k5err = gssd_k5_err_msg(context, code); ++ printerr(1, "WARNING: %s while initializing ccache for " ++ "principal '%s' using keytab '%s'\n", k5err, ++ pname ? pname : "", kt_name); ++ goto out; ++ } + if ((code = krb5_get_init_creds_keytab(context, &my_creds, ple->princ, + kt, 0, NULL, opts))) { + k5err = gssd_k5_err_msg(context, code); +@@ -436,61 +443,18 @@ gssd_get_single_krb5_cred(krb5_context context, + goto out; + } + +- /* +- * Initialize cache file which we're going to be using +- */ +- + pthread_mutex_lock(&ple_lock); +- if (use_memcache) +- cache_type = "MEMORY"; +- else +- cache_type = "FILE"; +- snprintf(cc_name, sizeof(cc_name), "%s:%s/%s%s_%s", +- cache_type, +- ccachesearch[0], GSSD_DEFAULT_CRED_PREFIX, +- GSSD_DEFAULT_MACHINE_CRED_SUFFIX, ple->realm); + ple->endtime = my_creds.times.endtime; +- if (ple->ccname == NULL || strcmp(ple->ccname, cc_name) != 0) { +- free(ple->ccname); +- ple->ccname = strdup(cc_name); +- if (ple->ccname == NULL) { +- printerr(0, "ERROR: no storage to duplicate credentials " +- "cache name '%s'\n", cc_name); +- code = ENOMEM; +- pthread_mutex_unlock(&ple_lock); +- goto out; +- } +- } + pthread_mutex_unlock(&ple_lock); +- if ((code = krb5_cc_resolve(context, cc_name, &ccache))) { +- k5err = gssd_k5_err_msg(context, code); +- printerr(0, "ERROR: %s while opening credential cache '%s'\n", +- k5err, cc_name); +- goto out; +- } +- if ((code = krb5_cc_initialize(context, ccache, ple->princ))) { +- k5err = gssd_k5_err_msg(context, code); +- printerr(0, "ERROR: %s while initializing credential " +- "cache '%s'\n", k5err, cc_name); +- goto out; +- } +- if ((code = krb5_cc_store_cred(context, ccache, &my_creds))) { +- k5err = gssd_k5_err_msg(context, code); +- printerr(0, "ERROR: %s while storing credentials in '%s'\n", +- k5err, cc_name); +- goto out; +- } + + code = 0; +- printerr(2, "%s(0x%lx): principal '%s' ccache:'%s'\n", +- __func__, tid, pname, cc_name); ++ printerr(2, "%s(0x%lx): principal '%s' ccache:'%s'\n", ++ __func__, tid, pname, ple->ccname); + out: + if (opts) + krb5_get_init_creds_opt_free(context, opts); + if (pname) + k5_free_unparsed_name(context, pname); +- if (ccache) +- krb5_cc_close(context, ccache); + krb5_free_cred_contents(context, &my_creds); + krb5_free_string(context, k5err); + return (code); +@@ -1108,10 +1072,12 @@ gssd_refresh_krb5_machine_credential_internal(char *hostname, + { + krb5_error_code code = 0; + krb5_context context; +- krb5_keytab kt = NULL;; ++ krb5_keytab kt = NULL; ++ krb5_ccache ccache = NULL; + int retval = 0; +- char *k5err = NULL; ++ char *k5err = NULL, *cache_type; + const char *svcnames[] = { "$", "root", "nfs", "host", NULL }; ++ char cc_name[BUFSIZ]; + + /* + * If a specific service name was specified, use it. +@@ -1170,7 +1136,38 @@ gssd_refresh_krb5_machine_credential_internal(char *hostname, + goto out_free_kt; + } + } +- retval = gssd_get_single_krb5_cred(context, kt, ple, 0); ++ ++ if (use_memcache) ++ cache_type = "MEMORY"; ++ else ++ cache_type = "FILE"; ++ snprintf(cc_name, sizeof(cc_name), "%s:%s/%s%s_%s", ++ cache_type, ++ ccachesearch[0], GSSD_DEFAULT_CRED_PREFIX, ++ GSSD_DEFAULT_MACHINE_CRED_SUFFIX, ple->realm); ++ ++ pthread_mutex_lock(&ple_lock); ++ if (ple->ccname == NULL || strcmp(ple->ccname, cc_name) != 0) { ++ free(ple->ccname); ++ ple->ccname = strdup(cc_name); ++ if (ple->ccname == NULL) { ++ printerr(0, "ERROR: no storage to duplicate credentials " ++ "cache name '%s'\n", cc_name); ++ code = ENOMEM; ++ pthread_mutex_unlock(&ple_lock); ++ goto out_free_kt; ++ } ++ } ++ pthread_mutex_unlock(&ple_lock); ++ if ((code = krb5_cc_resolve(context, cc_name, &ccache))) { ++ k5err = gssd_k5_err_msg(context, code); ++ printerr(0, "ERROR: %s while opening credential cache '%s'\n", ++ k5err, cc_name); ++ goto out_free_kt; ++ } ++ ++ retval = gssd_get_single_krb5_cred(context, kt, ple, 0, ccache); ++ krb5_cc_close(context, ccache); + out_free_kt: + krb5_kt_close(context, kt); + out_free_context: +-- +2.43.0 + diff --git a/nfs-utils-2.3.3-gssd-man-document-use-gss-proxy.patch b/nfs-utils-2.3.3-gssd-man-document-use-gss-proxy.patch new file mode 100644 index 0000000..b6f9536 --- /dev/null +++ b/nfs-utils-2.3.3-gssd-man-document-use-gss-proxy.patch @@ -0,0 +1,47 @@ +From 7511a77fc7eb7bd3ae38fcf54d49a47c25c3ed50 Mon Sep 17 00:00:00 2001 +From: Scott Mayhew +Date: Mon, 24 Mar 2025 08:59:24 -0400 +Subject: [nfs-utils PATCH] gssd.man: add documentation for use-gss-proxy + nfs.conf option + +Signed-off-by: Scott Mayhew +Signed-off-by: Steve Dickson +--- + utils/gssd/gssd.man | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man +index c735eff6..4a75b056 100644 +--- a/utils/gssd/gssd.man ++++ b/utils/gssd/gssd.man +@@ -392,6 +392,17 @@ Setting to + is equivalent to providing the + .B -H + flag. ++.TP ++.B use-gss-proxy ++Setting this to 1 allows ++.BR gssproxy (8) ++to intercept GSSAPI calls and service them on behalf of ++.BR rpc.gssd , ++enabling certain features such as keytab-based client initiation. ++Note that this is unrelated to the functionality that ++.BR gssproxy (8) ++provides on behalf of the NFS server. For more information, see ++.BR https://github.com/gssapi/gssproxy/blob/main/docs/NFS.md#nfs-client . + .P + In addtion, the following value is recognized from the + .B [general] +@@ -405,7 +416,8 @@ Equivalent to + .BR rpc.svcgssd (8), + .BR kerberos (1), + .BR kinit (1), +-.BR krb5.conf (5) ++.BR krb5.conf (5), ++.BR gssproxy (8) + .SH AUTHORS + .br + Dug Song +-- +2.48.1 + diff --git a/nfs-utils-2.3.3-gssd-unconditionally-use-krb5_get_init_creds_opt_all.patch b/nfs-utils-2.3.3-gssd-unconditionally-use-krb5_get_init_creds_opt_all.patch new file mode 100644 index 0000000..eabeda9 --- /dev/null +++ b/nfs-utils-2.3.3-gssd-unconditionally-use-krb5_get_init_creds_opt_all.patch @@ -0,0 +1,98 @@ +From 55d9bf151b100db9bf52e8f968e33f3ae1d234f5 Mon Sep 17 00:00:00 2001 +From: Olga Kornievskaia +Date: Mon, 24 Mar 2025 08:40:32 -0400 +Subject: [PATCH 1/2] gssd: unconditionally use krb5_get_init_creds_opt_alloc + +Note: This patch has a context difference from the upstream version +because RHEL 8 does not have c8659457 ("gssd: We never use the nocache +param of gssd_check_if_cc_exists()") or f066f87b ("gssd: enable forcing +cred renewal using the keytab"). + +Original commit message: + +Modern kerberos API uses krb5_get_init_creds_opt_alloc() for managing +its options for credential data structure. + +Signed-off-by: Olga Kornievskaia +Signed-off-by: Steve Dickson +(cherry picked from commit 9b3f949331c6541a358fc28bac323533f94d7e0b) +Signed-off-by: Scott Mayhew +--- + utils/gssd/krb5_util.c | 37 ++++++++++--------------------------- + 1 file changed, 10 insertions(+), 27 deletions(-) + +diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c +index a1a77a2f..871add74 100644 +--- a/utils/gssd/krb5_util.c ++++ b/utils/gssd/krb5_util.c +@@ -370,12 +370,7 @@ gssd_get_single_krb5_cred(krb5_context context, + struct gssd_k5_kt_princ *ple, + int nocache) + { +-#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS +- krb5_get_init_creds_opt *init_opts = NULL; +-#else +- krb5_get_init_creds_opt options; +-#endif +- krb5_get_init_creds_opt *opts; ++ krb5_get_init_creds_opt *opts = NULL; + krb5_creds my_creds; + krb5_ccache ccache = NULL; + char kt_name[BUFSIZ]; +@@ -413,33 +408,23 @@ gssd_get_single_krb5_cred(krb5_context context, + if ((krb5_unparse_name(context, ple->princ, &pname))) + pname = NULL; + +-#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS +- code = krb5_get_init_creds_opt_alloc(context, &init_opts); ++ code = krb5_get_init_creds_opt_alloc(context, &opts); + if (code) { + k5err = gssd_k5_err_msg(context, code); + printerr(0, "ERROR: %s allocating gic options\n", k5err); + goto out; + } +- if (krb5_get_init_creds_opt_set_addressless(context, init_opts, 1)) ++#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS ++ if (krb5_get_init_creds_opt_set_addressless(context, opts, 1)) + printerr(1, "WARNING: Unable to set option for addressless " + "tickets. May have problems behind a NAT.\n"); +-#ifdef TEST_SHORT_LIFETIME +- /* set a short lifetime (for debugging only!) */ +- printerr(1, "WARNING: Using (debug) short machine cred lifetime!\n"); +- krb5_get_init_creds_opt_set_tkt_life(init_opts, 5*60); ++#else ++ krb5_get_init_creds_opt_set_address_list(opts, NULL); + #endif +- opts = init_opts; +- +-#else /* HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS */ +- +- krb5_get_init_creds_opt_init(&options); +- krb5_get_init_creds_opt_set_address_list(&options, NULL); + #ifdef TEST_SHORT_LIFETIME + /* set a short lifetime (for debugging only!) */ +- printerr(0, "WARNING: Using (debug) short machine cred lifetime!\n"); +- krb5_get_init_creds_opt_set_tkt_life(&options, 5*60); +-#endif +- opts = &options; ++ printerr(1, "WARNING: Using (debug) short machine cred lifetime!\n"); ++ krb5_get_init_creds_opt_set_tkt_life(opts, 5*60); + #endif + + if ((code = krb5_get_init_creds_keytab(context, &my_creds, ple->princ, +@@ -500,10 +485,8 @@ gssd_get_single_krb5_cred(krb5_context context, + printerr(2, "%s(0x%lx): principal '%s' ccache:'%s'\n", + __func__, tid, pname, cc_name); + out: +-#ifdef HAVE_KRB5_GET_INIT_CREDS_OPT_SET_ADDRESSLESS +- if (init_opts) +- krb5_get_init_creds_opt_free(context, init_opts); +-#endif ++ if (opts) ++ krb5_get_init_creds_opt_free(context, opts); + if (pname) + k5_free_unparsed_name(context, pname); + if (ccache) +-- +2.43.0 + diff --git a/nfs-utils-2.3.3-mountstats-fixes.patch b/nfs-utils-2.3.3-mountstats-fixes.patch new file mode 100644 index 0000000..875dd69 --- /dev/null +++ b/nfs-utils-2.3.3-mountstats-fixes.patch @@ -0,0 +1,141 @@ +diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py +index 8e129c83..d488f9e1 100755 +--- a/tools/mountstats/mountstats.py ++++ b/tools/mountstats/mountstats.py +@@ -333,6 +333,11 @@ class DeviceData: + found = True + self.__parse_rpc_line(words) + ++ def fstype(self): ++ """Return the fstype for the mountpoint ++ """ ++ return self.__nfs_data['fstype'] ++ + def is_nfs_mountpoint(self): + """Return True if this is an NFS or NFSv4 mountpoint, + otherwise return False +@@ -953,73 +958,78 @@ def nfsstat_command(args): + return 0 + + def print_iostat_summary(old, new, devices, time): ++ if len(devices) == 0: ++ print('No NFS mount points were found') ++ return ++ + for device in devices: + stats = DeviceData() + stats.parse_stats(new[device]) +- if not old or device not in old: ++ if old and device in old: ++ old_stats = DeviceData() ++ old_stats.parse_stats(old[device]) ++ if stats.fstype() == old_stats.fstype(): ++ stats.compare_iostats(old_stats).display_iostats(time) ++ else: # device is in old, but fstypes are different ++ stats.display_iostats(time) ++ else: # device is only in new + stats.display_iostats(time) +- else: +- if ("fstype autofs" not in str(old[device])) and ("fstype autofs" not in str(new[device])): +- old_stats = DeviceData() +- old_stats.parse_stats(old[device]) +- diff_stats = stats.compare_iostats(old_stats) +- diff_stats.display_iostats(time) ++ ++def list_nfs_mounts(givenlist, mountstats): ++ """return a list of NFS mounts given a list to validate or ++ return a full list if the given list is empty - ++ may return an empty list if none found ++ """ ++ devicelist = [] ++ if len(givenlist) > 0: ++ for device in givenlist: ++ if device in mountstats: ++ stats = DeviceData() ++ stats.parse_stats(mountstats[device]) ++ if stats.is_nfs_mountpoint(): ++ devicelist += [device] ++ else: ++ for device, descr in mountstats.items(): ++ stats = DeviceData() ++ stats.parse_stats(descr) ++ if stats.is_nfs_mountpoint(): ++ devicelist += [device] ++ return devicelist + + def iostat_command(args): + """iostat-like command for NFS mount points + """ + mountstats = parse_stats_file(args.infile) +- devices = [os.path.normpath(mp) for mp in args.mountpoints] ++ origdevices = [os.path.normpath(mp) for mp in args.mountpoints] + + if args.since: + old_mountstats = parse_stats_file(args.since) + else: + old_mountstats = None + +- # make certain devices contains only NFS mount points +- if len(devices) > 0: +- check = [] +- for device in devices: +- stats = DeviceData() +- try: +- stats.parse_stats(mountstats[device]) +- if stats.is_nfs_mountpoint(): +- check += [device] +- except KeyError: +- continue +- devices = check +- else: +- for device, descr in mountstats.items(): +- stats = DeviceData() +- stats.parse_stats(descr) +- if stats.is_nfs_mountpoint(): +- devices += [device] +- if len(devices) == 0: +- print('No NFS mount points were found') +- return 1 +- + sample_time = 0 + ++ # make certain devices contains only NFS mount points ++ devices = list_nfs_mounts(origdevices, mountstats) ++ print_iostat_summary(old_mountstats, mountstats, devices, sample_time) ++ + if args.interval is None: +- print_iostat_summary(old_mountstats, mountstats, devices, sample_time) + return + +- if args.count is not None: +- count = args.count +- while count != 0: +- print_iostat_summary(old_mountstats, mountstats, devices, sample_time) +- old_mountstats = mountstats +- time.sleep(args.interval) +- sample_time = args.interval +- mountstats = parse_stats_file(args.infile) ++ count = args.count ++ while True: ++ if count is not None: + count -= 1 +- else: +- while True: +- print_iostat_summary(old_mountstats, mountstats, devices, sample_time) +- old_mountstats = mountstats +- time.sleep(args.interval) +- sample_time = args.interval +- mountstats = parse_stats_file(args.infile) ++ if count == 0: ++ break ++ time.sleep(args.interval) ++ old_mountstats = mountstats ++ sample_time = args.interval ++ mountstats = parse_stats_file(args.infile) ++ # nfs mountpoints may appear or disappear, so we need to ++ # recheck the devices list each time we parse mountstats ++ devices = list_nfs_mounts(origdevices, mountstats) ++ print_iostat_summary(old_mountstats, mountstats, devices, sample_time) + + args.infile.close() + if args.since: diff --git a/nfs-utils-2.3.3-nfs-man-rdirplus.patch b/nfs-utils-2.3.3-nfs-man-rdirplus.patch new file mode 100644 index 0000000..e217890 --- /dev/null +++ b/nfs-utils-2.3.3-nfs-man-rdirplus.patch @@ -0,0 +1,47 @@ +From 3cca9dbeab3b159c27c1dc48e791139744baf6d0 Mon Sep 17 00:00:00 2001 +From: Benjamin Coddington +Date: Mon, 24 Mar 2025 15:47:43 -0400 +Subject: [nfs-utils PATCH] nfs(5): Add new rdirplus functionality, clarify + +The proposed kernel [patch][1] will modify the rdirplus mount option to +accept optional string values of "none" and "force". Update the man page +to reflect these changes and clarify the current client's behavior for the +default. + +[1]: https://lore.kernel.org/linux-nfs/8c33cd92be52255b0dd0a7489c9e5cc35434ec95.1741876784.git.bcodding@redhat.com/T/#u + +Signed-off-by: Benjamin Coddington +Signed-off-by: Steve Dickson +--- + utils/mount/nfs.man | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man +index b5c5913b..94dc29d4 100644 +--- a/utils/mount/nfs.man ++++ b/utils/mount/nfs.man +@@ -434,11 +434,16 @@ option may also be used by some pNFS drivers to decide how many + connections to set up to the data servers. + .TP 1.5i + .BR rdirplus " / " nordirplus +-Selects whether to use NFS v3 or v4 READDIRPLUS requests. +-If this option is not specified, the NFS client uses READDIRPLUS requests +-on NFS v3 or v4 mounts to read small directories. +-Some applications perform better if the client uses only READDIR requests +-for all directories. ++Selects whether to use NFS v3 or v4 READDIRPLUS requests. If this option is ++not specified, the NFS client uses a heuristic to optimize performance by ++choosing READDIR vs READDIRPLUS based on how often the calling process uses ++the additional attributes returned from READDIRPLUS. Some applications ++perform better if the client uses only READDIR requests for all directories. ++.TP 1.5i ++.BR rdirplus={none|force} ++If set to "force", the NFS client always attempts to use READDIRPLUS ++requests. If set to "none", the behavior is the same as ++.B nordirplus. + .TP 1.5i + .BI retry= n + The number of minutes that the +-- +2.48.1 + diff --git a/nfs-utils-2.3.3-nfsiostat-fixes.patch b/nfs-utils-2.3.3-nfsiostat-fixes.patch new file mode 100644 index 0000000..afbebf8 --- /dev/null +++ b/nfs-utils-2.3.3-nfsiostat-fixes.patch @@ -0,0 +1,242 @@ +26f8410d mountstats/nfsiostat: merge and rework the infinite and counted loops +21238e5c mountstats/nfsiostat: Move the checks for empty mountpoint list into the print function +1bd30a9d nfsiostat: make comment explain mount/unmount more broadly +2b9251ed nfsiostat: fix crash when filtering mountstats after unmount +9836adbc nfsiostat: mirror how mountstats iostat prints the stats +936a19cc mountstats/nfsiostat: add a function to return the fstype +155c5343 nfsiostat: skip argv[0] when parsing command-line +39f57998 nfsiostat/mountstats: handle KeyError in compare_iostats() +c4c14011 nfsiostat: replace 'list' reserved word + +diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py +index 7cbe543c..dec0e861 100644 +--- a/tools/nfs-iostat/nfs-iostat.py ++++ b/tools/nfs-iostat/nfs-iostat.py +@@ -493,20 +493,20 @@ def list_nfs_mounts(givenlist, mountstats): + return a full list if the given list is empty - + may return an empty list if none found + """ +- list = [] ++ devicelist = [] + if len(givenlist) > 0: + for device in givenlist: + stats = DeviceData() + stats.parse_stats(mountstats[device]) + if stats.is_nfs_mountpoint(): +- list += [device] ++ devicelist += [device] + else: + for device, descr in mountstats.items(): + stats = DeviceData() + stats.parse_stats(descr) + if stats.is_nfs_mountpoint(): +- list += [device] +- return list ++ devicelist += [device] ++ return devicelist + + def iostat_command(name): + """iostat-like command for NFS mount points +diff --git a/tools/mountstats/mountstats.py b/tools/mountstats/mountstats.py +index 014f38a3..1054f698 100755 +--- a/tools/mountstats/mountstats.py ++++ b/tools/mountstats/mountstats.py +@@ -560,7 +560,10 @@ class DeviceData: + # the reference to them. so we build new lists here + # for the result object. + for op in result.__rpc_data['ops']: +- result.__rpc_data[op] = list(map(difference, self.__rpc_data[op], old_stats.__rpc_data[op])) ++ try: ++ result.__rpc_data[op] = list(map(difference, self.__rpc_data[op], old_stats.__rpc_data[op])) ++ except KeyError: ++ continue + + # update the remaining keys + if protocol == 'udp': +diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py +index b7e98a2a..5556f692 100755 +--- a/tools/nfs-iostat/nfs-iostat.py ++++ b/tools/nfs-iostat/nfs-iostat.py +@@ -213,8 +213,11 @@ class DeviceData: + # the reference to them. so we build new lists here + # for the result object. + for op in result.__rpc_data['ops']: +- result.__rpc_data[op] = list(map( +- difference, self.__rpc_data[op], old_stats.__rpc_data[op])) ++ try: ++ result.__rpc_data[op] = list(map( ++ difference, self.__rpc_data[op], old_stats.__rpc_data[op])) ++ except KeyError: ++ continue + + # update the remaining keys we care about + result.__rpc_data['rpcsends'] -= old_stats.__rpc_data['rpcsends'] +diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py +index 85294fb9..e46b1a83 100755 +--- a/tools/nfs-iostat/nfs-iostat.py ++++ b/tools/nfs-iostat/nfs-iostat.py +@@ -187,6 +187,11 @@ class DeviceData: + found = True + self.__parse_rpc_line(words) + ++ def fstype(self): ++ """Return the fstype for the mountpoint ++ """ ++ return self.__nfs_data['fstype'] ++ + def is_nfs_mountpoint(self): + """Return True if this is an NFS or NFSv4 mountpoint, + otherwise return False +@@ -471,41 +476,31 @@ def parse_stats_file(filename): + return ms_dict + + def print_iostat_summary(old, new, devices, time, options): +- stats = {} +- diff_stats = {} +- devicelist = [] +- if old: +- # Trim device list to only include intersection of old and new data, +- # this addresses umounts due to autofs mountpoints +- for device in devices: +- if "fstype autofs" not in str(old[device]): +- devicelist.append(device) +- else: +- devicelist = devices ++ display_stats = {} ++ ++ if len(devices) == 0: ++ print('No NFS mount points were found') ++ return + +- for device in devicelist: +- stats[device] = DeviceData() +- stats[device].parse_stats(new[device]) +- if old: ++ for device in devices: ++ stats = DeviceData() ++ stats.parse_stats(new[device]) ++ if old and device in old: + old_stats = DeviceData() + old_stats.parse_stats(old[device]) +- diff_stats[device] = stats[device].compare_iostats(old_stats) ++ if stats.fstype() == old_stats.fstype(): ++ display_stats[device] = stats.compare_iostats(old_stats) ++ else: # device is in old, but fstypes are different ++ display_stats[device] = stats ++ else: # device is only in new ++ display_stats[device] = stats + + if options.sort: +- if old: +- # We now have compared data and can print a comparison +- # ordered by mountpoint ops per second +- devicelist.sort(key=lambda x: diff_stats[x].ops(time), reverse=True) +- else: +- # First iteration, just sort by newly parsed ops/s +- devicelist.sort(key=lambda x: stats[x].ops(time), reverse=True) ++ devices.sort(key=lambda x: display_stats[x].ops(time), reverse=True) + + count = 1 +- for device in devicelist: +- if old: +- diff_stats[device].display_iostats(time, options.which) +- else: +- stats[device].display_iostats(time, options.which) ++ for device in devices: ++ display_stats[device].display_iostats(time, options.which) + + count += 1 + if (count > options.list): +@@ -520,10 +515,11 @@ def list_nfs_mounts(givenlist, mountstats): + devicelist = [] + if len(givenlist) > 0: + for device in givenlist: +- stats = DeviceData() +- stats.parse_stats(mountstats[device]) +- if stats.is_nfs_mountpoint(): +- devicelist += [device] ++ if device in mountstats: ++ stats = DeviceData() ++ stats.parse_stats(mountstats[device]) ++ if stats.is_nfs_mountpoint(): ++ devicelist += [device] + else: + for device, descr in mountstats.items(): + stats = DeviceData() +@@ -592,11 +588,7 @@ client are listed. + parser.add_option_group(displaygroup) + + (options, args) = parser.parse_args(sys.argv) +- for arg in args: +- +- if arg == sys.argv[0]: +- continue +- ++ for arg in args[1:]: + if arg in mountstats: + origdevices += [arg] + elif not interval_seen: +@@ -622,47 +614,29 @@ client are listed. + print('Illegal value %s' % arg) + return + +- # make certain devices contains only NFS mount points +- devices = list_nfs_mounts(origdevices, mountstats) +- if len(devices) == 0: +- print('No NFS mount points were found') +- return +- +- + old_mountstats = None + sample_time = 0.0 + ++ # make certain devices contains only NFS mount points ++ devices = list_nfs_mounts(origdevices, mountstats) ++ print_iostat_summary(old_mountstats, mountstats, devices, sample_time, options) ++ + if not interval_seen: +- print_iostat_summary(old_mountstats, mountstats, devices, sample_time, options) + return + +- if count_seen: +- while count != 0: +- print_iostat_summary(old_mountstats, mountstats, devices, sample_time, options) +- old_mountstats = mountstats +- time.sleep(interval) +- sample_time = interval +- mountstats = parse_stats_file('/proc/self/mountstats') +- # automount mountpoints add and drop, if automount is involved +- # we need to recheck the devices list when reparsing +- devices = list_nfs_mounts(origdevices,mountstats) +- if len(devices) == 0: +- print('No NFS mount points were found') +- return ++ while True: ++ if count_seen: + count -= 1 +- else: +- while True: +- print_iostat_summary(old_mountstats, mountstats, devices, sample_time, options) +- old_mountstats = mountstats +- time.sleep(interval) +- sample_time = interval +- mountstats = parse_stats_file('/proc/self/mountstats') +- # automount mountpoints add and drop, if automount is involved +- # we need to recheck the devices list when reparsing +- devices = list_nfs_mounts(origdevices,mountstats) +- if len(devices) == 0: +- print('No NFS mount points were found') +- return ++ if count == 0: ++ break ++ time.sleep(interval) ++ old_mountstats = mountstats ++ sample_time = interval ++ mountstats = parse_stats_file('/proc/self/mountstats') ++ # nfs mountpoints may appear or disappear, so we need to ++ # recheck the devices list each time we parse mountstats ++ devices = list_nfs_mounts(origdevices, mountstats) ++ print_iostat_summary(old_mountstats, mountstats, devices, sample_time, options) + + # + # Main diff --git a/nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch b/nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch deleted file mode 100644 index 65f92de..0000000 --- a/nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 4f91877bb313a35ade44d9dde1fd219035ba1fd9 Mon Sep 17 00:00:00 2001 -From: Patrick Steinhardt -Date: Wed, 27 Feb 2019 11:58:47 -0500 -Subject: [PATCH] configure.ac: more carefully detect availability of - res_querydomain(3) - -Since glibc 2.2, the function res_querydomain(3) is implemented as a -define to `__res_querydomain`. Due to this implementation detail, using -`AC_CHECK_LIB` with a symbol name of "res_querydomain" will cause a -linking failure and thus fail to detect its availability. This is why -right now, we try to detect availability of `__res_querydomain` instead. - -Unfortunately, this may break on other platforms where there is no -`__res_querydomain` but only the function without leading underscores. -To fix this, we can perform another `AC_CHECK_LIB([resolv], -[res_querydomain], ...)` call in case where the other one was not found -and only raise an error if both symbols weren't found. - -Signed-off-by: Patrick Steinhardt -Signed-off-by: Steve Dickson ---- - configure.ac | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/configure.ac b/configure.ac -index 4bf5aea..cb9d921 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -411,7 +411,8 @@ if test "$enable_gss" = yes; then - fi - - dnl libdnsidmap specific checks --AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain needed)) -+AC_CHECK_LIB([resolv], [__res_querydomain], , -+ AC_CHECK_LIB([resolv], [res_querydomain], , AC_MSG_ERROR(res_querydomain needed))) - - AC_ARG_ENABLE([ldap], - [AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:default=detect@:>@])]) --- -1.8.3.1 - diff --git a/nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch b/nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch deleted file mode 100644 index ffa206c..0000000 --- a/nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 49235a6f1290626333ab4b2af915805f71c60081 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Sat, 22 May 2021 11:03:31 -0400 -Subject: [PATCH] Fix NFSv4 export of tmpfs filesystems - -Some filesystems cannot be exported without an fsid or uuid. -tmpfs is the main example. - -When mountd (or exportd) creates nfsv4 pseudo-root exports for the path -leading down to an export point it exports each directory without any -fsid or uuid. If one of these directories is on tmpfs, that will fail. - -The net result is that exporting a subdirectory of a tmpfs filesystem -will not work over NFSv4 as the parents within the filesystem cannot be -exported. It will either fail, or fall-back to NFSv3 (depending on the -version of the mount.nfs program). - -To fix this we need to provide an fsid or uuid for these pseudo-root -exports. This patch does that by creating an RFC-4122 V5 compatible -UUID based on an arbitrary seed and the path to the export. - -To check if an export needs a uuid, text_export() is moved from exportfs -to libexport.a, modified slightly and renamed to export_test(). - -backport note: -Currently there isn't exportd, attention. - -Reported-by: Petr Vorel -Reviewed-by: Petr Vorel -Tested-by: Petr Vorel -Signed-off-by: NeilBrown -Signed-off-by: Steve Dickson -Signed-off-by: Ferry Meng ---- - support/export/cache.c | 3 ++- - support/export/export.c | 29 +++++++++++++++++++++++++++++ - support/export/v4root.c | 21 +++++++++++++++++++++ - support/include/exportfs.h | 1 + - utils/exportfs/exportfs.c | 33 +++------------------------------ - utils/mountd/Makefile.am | 2 +- - 6 files changed, 57 insertions(+), 32 deletions(-) - -diff --git a/support/export/cache.c b/support/export/cache.c -index 98d5082..b77b608 100644 ---- a/support/export/cache.c -+++ b/support/export/cache.c -@@ -899,7 +899,8 @@ static int dump_to_cache(int f, char *buf, int buflen, char *domain, - write_secinfo(&bp, &blen, exp, flag_mask); - if (exp->e_uuid == NULL || different_fs) { - char u[16]; -- if (uuid_by_path(path, 0, 16, u)) { -+ if ((exp->e_flags & flag_mask & NFSEXP_FSID) == 0 && -+ uuid_by_path(path, 0, 16, u)) { - qword_add(&bp, &blen, "uuid"); - qword_addhex(&bp, &blen, u, 16); - } -diff --git a/support/export/export.c b/support/export/export.c -index fbe68e8..0c4b617 100644 ---- a/support/export/export.c -+++ b/support/export/export.c -@@ -10,9 +10,11 @@ - #include - #endif - -+#include - #include - #include - #include -+#include - #include - #include - #include -@@ -388,3 +390,30 @@ export_hash(char *str) - - return num % HASH_TABLE_SIZE; - } -+ -+int export_test(struct exportent *eep, int with_fsid) -+{ -+ char *path = eep->e_path; -+ int flags = eep->e_flags | (with_fsid ? NFSEXP_FSID : 0); -+ /* beside max path, buf size should take protocol str into account */ -+ char buf[NFS_MAXPATHLEN+1+64] = { 0 }; -+ char *bp = buf; -+ int len = sizeof(buf); -+ int fd, n; -+ -+ n = snprintf(buf, len, "-test-client- "); -+ bp += n; -+ len -= n; -+ qword_add(&bp, &len, path); -+ if (len < 1) -+ return 0; -+ snprintf(bp, len, " 3 %d 65534 65534 0\n", flags); -+ fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); -+ if (fd < 0) -+ return 0; -+ n = write(fd, buf, strlen(buf)); -+ close(fd); -+ if (n < 0) -+ return 0; -+ return 1; -+} -diff --git a/support/export/v4root.c b/support/export/v4root.c -index 3654bd7..fff7f54 100644 ---- a/support/export/v4root.c -+++ b/support/export/v4root.c -@@ -20,6 +20,7 @@ - - #include - #include -+#include - - #include "xlog.h" - #include "exportfs.h" -@@ -89,6 +90,26 @@ v4root_create(char *path, nfs_export *export) - strncpy(eep.e_path, path, sizeof(eep.e_path)-1); - if (strcmp(path, "/") != 0) - eep.e_flags &= ~NFSEXP_FSID; -+ -+ if (strcmp(path, "/") != 0 && -+ !export_test(&eep, 0)) { -+ /* Need a uuid - base it on path using a fixed seed that -+ * was generated randomly. -+ */ -+ const char seed_s[] = "39c6b5c1-3f24-4f4e-977c-7fe6546b8a25"; -+ uuid_t seed, uuid; -+ char uuid_s[UUID_STR_LEN]; -+ unsigned int i, j; -+ -+ uuid_parse(seed_s, seed); -+ uuid_generate_sha1(uuid, seed, path, strlen(path)); -+ uuid_unparse_upper(uuid, uuid_s); -+ /* strip hyhens */ -+ for (i = j = 0; uuid_s[i]; i++) -+ if (uuid_s[i] != '-') -+ uuid_s[j++] = uuid_s[i]; -+ eep.e_uuid = uuid_s; -+ } - set_pseudofs_security(&eep); - exp = export_create(&eep, 0); - if (exp == NULL) -diff --git a/support/include/exportfs.h b/support/include/exportfs.h -index bfae195..301486b 100644 ---- a/support/include/exportfs.h -+++ b/support/include/exportfs.h -@@ -172,5 +172,6 @@ struct export_features { - - struct export_features *get_export_features(void); - void fix_pseudoflavor_flags(struct exportent *ep); -+int export_test(struct exportent *eep, int with_fsid); - - #endif /* EXPORTFS_H */ -diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c -index c162c03..50fbe6c 100644 ---- a/utils/exportfs/exportfs.c -+++ b/utils/exportfs/exportfs.c -@@ -485,33 +485,6 @@ static int can_test(void) - return 1; - } - --static int test_export(nfs_export *exp, int with_fsid) --{ -- char *path = exp->m_export.e_path; -- int flags = exp->m_export.e_flags | (with_fsid ? NFSEXP_FSID : 0); -- /* beside max path, buf size should take protocol str into account */ -- char buf[NFS_MAXPATHLEN+1+64] = { 0 }; -- char *bp = buf; -- int len = sizeof(buf); -- int fd, n; -- -- n = snprintf(buf, len, "-test-client- "); -- bp += n; -- len -= n; -- qword_add(&bp, &len, path); -- if (len < 1) -- return 0; -- snprintf(bp, len, " 3 %d 65534 65534 0\n", flags); -- fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); -- if (fd < 0) -- return 0; -- n = write(fd, buf, strlen(buf)); -- close(fd); -- if (n < 0) -- return 0; -- return 1; --} -- - static void - validate_export(nfs_export *exp) - { -@@ -543,12 +516,12 @@ validate_export(nfs_export *exp) - - if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid || - fs_has_fsid) { -- if ( !test_export(exp, 1)) { -+ if ( !export_test(&exp->m_export, 1)) { - xlog(L_ERROR, "%s does not support NFS export", path); - return; - } -- } else if ( !test_export(exp, 0)) { -- if (test_export(exp, 1)) -+ } else if ( !export_test(&exp->m_export, 0)) { -+ if (export_test(&exp->m_export, 1)) - xlog(L_ERROR, "%s requires fsid= for NFS export", path); - else - xlog(L_ERROR, "%s does not support NFS export", path); -diff --git a/utils/mountd/Makefile.am b/utils/mountd/Makefile.am -index c41f06d..dab9f97 100644 ---- a/utils/mountd/Makefile.am -+++ b/utils/mountd/Makefile.am -@@ -19,7 +19,7 @@ mountd_LDADD = ../../support/export/libexport.a \ - ../../support/nfs/libnfs.la \ - ../../support/misc/libmisc.a \ - $(OPTLIBS) \ -- $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) $(LIBTIRPC) -+ $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) -luuid $(LIBTIRPC) - mountd_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \ - -I$(top_builddir)/support/include \ - -I$(top_srcdir)/support/export --- -2.39.3 - diff --git a/nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch b/nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch deleted file mode 100644 index 69bfa6c..0000000 --- a/nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 930f71a4b69c0342c2afdcbdcdad997c92be8167 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Sat, 22 May 2021 11:12:11 -0400 -Subject: [PATCH 3/3] Move declaration of etab and rmtab into libraries - -There are two global "struct stat_paths" structures: etab and rmtab. -They are currently needed by some library code so any program which is -linked with that library code needs to declare the structures even if it -doesn't use the functionality. This is clumsy and error-prone. - -Instead: have the library declare the structure and put the definition -in a header file. Now programs only need to know about these structures -if they use the functionality. - -'rmtab' is now declared in libnfs.a (rmtab.c). 'etab' is declared in -export.a (xtab.c). - -Reviewed-by: Petr Vorel -Signed-off-by: NeilBrown -Signed-off-by: Steve Dickson -Signed-off-by: Ferry Meng ---- - support/export/auth.c | 2 -- - support/export/xtab.c | 2 +- - support/include/exportfs.h | 1 + - support/include/nfslib.h | 1 + - support/nfs/rmtab.c | 2 +- - utils/exportfs/exportfs.c | 2 -- - utils/mountd/mountd.c | 3 --- - utils/mountd/rmtab.c | 2 -- - 8 files changed, 4 insertions(+), 11 deletions(-) - -diff --git a/support/export/auth.c b/support/export/auth.c -index 73ad6f7..318d165 100644 ---- a/support/export/auth.c -+++ b/support/export/auth.c -@@ -41,8 +41,6 @@ static nfs_client my_client; - - extern int use_ipaddr; - --extern struct state_paths etab; -- - /* - void - auth_init(void) -diff --git a/support/export/xtab.c b/support/export/xtab.c -index 1e1d679..4ca7e91 100644 ---- a/support/export/xtab.c -+++ b/support/export/xtab.c -@@ -27,7 +27,7 @@ - #include "misc.h" - - static char state_base_dirname[PATH_MAX] = NFS_STATEDIR; --extern struct state_paths etab; -+struct state_paths etab; - - int v4root_needed; - static void cond_rename(char *newfile, char *oldfile); -diff --git a/support/include/exportfs.h b/support/include/exportfs.h -index 301486b..400805d 100644 ---- a/support/include/exportfs.h -+++ b/support/include/exportfs.h -@@ -145,6 +145,7 @@ nfs_export * export_create(struct exportent *, int canonical); - void exportent_release(struct exportent *); - void export_freeall(void); - -+extern struct state_paths etab; - int xtab_export_read(void); - int xtab_export_write(void); - -diff --git a/support/include/nfslib.h b/support/include/nfslib.h -index ab8b2bf..90a27d7 100644 ---- a/support/include/nfslib.h -+++ b/support/include/nfslib.h -@@ -104,6 +104,7 @@ void dupexportent(struct exportent *dst, - struct exportent *src); - int updateexportent(struct exportent *eep, char *options); - -+extern struct state_paths rmtab; - int setrmtabent(char *type); - struct rmtabent * getrmtabent(int log, long *pos); - void putrmtabent(struct rmtabent *xep, long *pos); -diff --git a/support/nfs/rmtab.c b/support/nfs/rmtab.c -index 2ecb2cc..d30e625 100644 ---- a/support/nfs/rmtab.c -+++ b/support/nfs/rmtab.c -@@ -33,7 +33,7 @@ - - static FILE *rmfp = NULL; - --extern struct state_paths rmtab; -+struct state_paths rmtab; - - int - setrmtabent(char *type) -diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c -index dd19776..2957f41 100644 ---- a/utils/exportfs/exportfs.c -+++ b/utils/exportfs/exportfs.c -@@ -51,8 +51,6 @@ static void release_lockfile(void); - static const char *lockfile = EXP_LOCKFILE; - static int _lockfd = -1; - --struct state_paths etab; -- - /* - * If we aren't careful, changes made by exportfs can be lost - * when multiple exports process run at once: -diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c -index 2b34237..93d9248 100644 ---- a/utils/mountd/mountd.c -+++ b/utils/mountd/mountd.c -@@ -42,9 +42,6 @@ int reverse_resolve = 0; - int manage_gids; - int use_ipaddr = -1; - --struct state_paths etab; --struct state_paths rmtab; -- - /* PRC: a high-availability callout program can be specified with -H - * When this is done, the program will receive callouts whenever clients - * send mount or unmount requests -- the callout is not needed for 2.6 kernel */ -diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c -index 3ae0dbb..fdaafbc 100644 ---- a/utils/mountd/rmtab.c -+++ b/utils/mountd/rmtab.c -@@ -28,8 +28,6 @@ - - extern int reverse_resolve; - --extern struct state_paths rmtab; -- - /* If new path is a link do not destroy it but place the - * file where the link points. - */ --- -2.39.3 - diff --git a/nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch b/nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch deleted file mode 100644 index ebfa5ad..0000000 --- a/nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch +++ /dev/null @@ -1,136 +0,0 @@ -From a0efbb254f6f8703bc4bcaf6b49d49e1a3e7d90f Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Sat, 22 May 2021 11:06:13 -0400 -Subject: [PATCH] Remove 'force' arg from cache_flush() - -Since v4.17 the timestamp written to 'flush' is ignored, -so there isn't much point choosing too precisely. - -For kernels since v4.3-rc3-13-g778620364ef5 it is safe -to write 1 second beyond the current time. - -For earlier kernels, nothing is really safe (even the current -behaviour), but writing one second beyond the current time isn't too bad -in the unlikely case the people use a new nfs-utils on a 5 year old -kernel. - -This remove a dependency for libnfs.a on 'etab' being declare, -so svcgssd no longer needs to declare it. - -Reviewed-by: Petr Vorel -Signed-off-by: NeilBrown -Signed-off-by: Steve Dickson -Signed-off-by: Ferry Meng ---- - support/export/auth.c | 2 +- - support/include/nfslib.h | 2 +- - support/nfs/cacheio.c | 17 ++++++++--------- - utils/exportfs/exportfs.c | 4 ++-- - utils/gssd/svcgssd.c | 1 - - 5 files changed, 12 insertions(+), 14 deletions(-) - -diff --git a/support/export/auth.c b/support/export/auth.c -index 73ad6f7..c5e1b5c 100644 ---- a/support/export/auth.c -+++ b/support/export/auth.c -@@ -80,7 +80,7 @@ check_useipaddr(void) - use_ipaddr = 0; - - if (use_ipaddr != old_use_ipaddr) -- cache_flush(1); -+ cache_flush(); - } - - unsigned int -diff --git a/support/include/nfslib.h b/support/include/nfslib.h -index ab8b2bf..bbe8886 100644 ---- a/support/include/nfslib.h -+++ b/support/include/nfslib.h -@@ -130,7 +130,7 @@ int wildmat(char *text, char *pattern); - - int qword_get(char **bpp, char *dest, int bufsize); - int qword_get_int(char **bpp, int *anint); --void cache_flush(int force); -+void cache_flush(void); - void qword_add(char **bpp, int *lp, char *str); - void qword_addhex(char **bpp, int *lp, char *buf, int blen); - void qword_addint(char **bpp, int *lp, int n); -diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c -index 7c4cf37..c0f19cd 100644 ---- a/support/nfs/cacheio.c -+++ b/support/nfs/cacheio.c -@@ -31,8 +31,6 @@ - #include - #include - --extern struct state_paths etab; -- - void qword_add(char **bpp, int *lp, char *str) - { - char *bp = *bpp; -@@ -212,7 +210,7 @@ int qword_get_uint(char **bpp, unsigned int *anint) - */ - - void --cache_flush(int force) -+cache_flush(void) - { - struct stat stb; - int c; -@@ -233,12 +231,13 @@ cache_flush(int force) - NULL - }; - now = time(0); -- if (force || -- stat(etab.statefn, &stb) != 0 || -- stb.st_mtime > now) -- stb.st_mtime = time(0); -- -- sprintf(stime, "%ld\n", stb.st_mtime); -+ -+ /* Since v4.16-rc2-3-g3b68e6ee3cbd the timestamp written is ignored. -+ * It is safest always to flush caches if there is any doubt. -+ * For earlier kernels, writing the next second from now is -+ * the best we can do. -+ */ -+ sprintf(stime, "%ld\n", now+1); - for (c=0; cachelist[c]; c++) { - int fd; - sprintf(path, "/proc/net/rpc/%s/flush", cachelist[c]); -diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c -index 50fbe6c..5a2f6ff 100644 ---- a/utils/exportfs/exportfs.c -+++ b/utils/exportfs/exportfs.c -@@ -170,7 +170,7 @@ main(int argc, char **argv) - return 1; - if (optind == argc && ! f_all) { - if (force_flush) { -- cache_flush(1); -+ cache_flush(); - free_state_path_names(&etab); - return 0; - } else { -@@ -216,7 +216,7 @@ main(int argc, char **argv) - unexportfs(argv[i], f_verbose); - } - xtab_export_write(); -- cache_flush(force_flush); -+ cache_flush(); - free_state_path_names(&etab); - - return export_errno; -diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c -index ec49b61..d728eaf 100644 ---- a/utils/gssd/svcgssd.c -+++ b/utils/gssd/svcgssd.c -@@ -63,7 +63,6 @@ - #include "err_util.h" - #include "conffile.h" - --struct state_paths etab; - - static void - sig_die(int signal) --- -2.39.3 - diff --git a/nfs-utils.spec b/nfs-utils.spec index 748251c..62d3691 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -1,10 +1,8 @@ -%define anolis_release .0.4 - 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: 59%{anolis_release}%{?dist}%{?lifsea_dist} +Release: 64%{?dist} Epoch: 1 # group all 32bit related archs @@ -14,11 +12,9 @@ Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{v Source1: id_resolver.conf Source2: lockd.conf Source3: 24-nfs-server.conf -%if ! %{defined lifsea_dist} Source4: nfsconvert.py Source5: nfsconvert.sh Source6: nfs-convert.service -%endif # # RHEL 8.0 @@ -113,24 +109,22 @@ Patch055: nfs-utils-2.3.3-systemd-rpcstatd.patch Patch056: nfs-utils-2.3.3-mountd-v4clnts.patch Patch057: nfs-utils-2.3.3-covscan-return-value.patch +# +# RHEL 8.10.z +# +Patch058: nfs-utils-2.3.3-gssd-man-document-use-gss-proxy.patch +Patch059: nfs-utils-2.3.3-gssd-unconditionally-use-krb5_get_init_creds_opt_all.patch +Patch060: nfs-utils-2.3.3-gssd-do-not-use-krb5_cc_initialize.patch +Patch061: nfs-utils-2.3.3-nfsiostat-fixes.patch +Patch062: nfs-utils-2.3.3-mountstats-fixes.patch +Patch063: nfs-utils-2.3.3-nfs-man-rdirplus.patch + Patch100: nfs-utils-1.2.1-statdpath-man.patch Patch101: nfs-utils-1.2.1-exp-subtree-warn-off.patch 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 -Patch105: nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch -Patch106: nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch -Patch107: nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.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 -Patch1003: 0001-nfs-disable-v4client-for-loongarch.patch -Patch1004: nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch -# End: Anolis customized patches - Provides: exportfs = %{epoch}:%{version}-%{release} Provides: nfsstat = %{epoch}:%{version}-%{release} Provides: showmount = %{epoch}:%{version}-%{release} @@ -149,8 +143,7 @@ Provides: start-statd = %{epoch}:%{version}-%{release} License: MIT and GPLv2 and GPLv2+ and BSD Requires: rpcbind, sed, gawk, grep -Requires: kmod, keyutils, quota -%{!?lifsea_dist:Requires: python3-pyyaml} +Requires: kmod, keyutils, quota, python3-pyyaml BuildRequires: libevent-devel libcap-devel BuildRequires: libtirpc-devel libblkid-devel BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 @@ -160,7 +153,6 @@ BuildRequires: sqlite-devel BuildRequires: python3-devel BuildRequires: systemd BuildRequires: rpcgen -BuildRequires: libuuid-devel Requires(pre): shadow-utils >= 4.0.3-25 Requires(pre): util-linux Requires(pre): coreutils @@ -168,7 +160,7 @@ Requires(preun): coreutils Requires: libnfsidmap libevent Requires: libtirpc >= 0.2.3-1 libblkid libcap libmount %{?systemd_requires} -%{!?lifsea_dist:Requires: gssproxy => 0.7.0-3} +Requires: gssproxy => 0.7.0-3 %package -n libnfsidmap Summary: NFSv4 User and Group ID Mapping Library @@ -197,13 +189,6 @@ developing programs which use the libnfsidmap library. The nfs-utils package provides various utilities for use with NFS clients and servers. -# To avoid users installing the LifseaOS package in other os -%define common_pre_scripts() \ -if ! grep -q 'ID="lifsea"' /etc/os-release; then \ - echo "This package is only for LifseaOS!" \ - exit 1 \ -fi - %prep %autosetup -p1 @@ -256,11 +241,9 @@ install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/request-key.d mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/scripts install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/lockd.conf install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/gssproxy -%if ! %{defined lifsea_dist} install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/nfsconvert -install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/%{_libexecdir}/nfs-utils/nfsconvert.sh +install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/%{_libexecdir}/nfs-utils/nfsconvert.sh install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_pkgdir}/system -%endif rm -rf $RPM_BUILD_ROOT%{_libdir}/*.{a,la} @@ -278,9 +261,6 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/exports.d %pre -%if %{defined lifsea_dist} -%{common_pre_scripts} -%endif # move files so the running service will have this applied as well for x in gssd idmapd ; do if [ -f /var/lock/subsys/rpc.$x ]; then @@ -288,14 +268,6 @@ for x in gssd idmapd ; do fi done -%if %{defined lifsea_dist} -%pre -n libnfsidmap -%{common_pre_scripts} - -%pre -n libnfsidmap-devel -%{common_pre_scripts} -%endif - %define rpcuser_uid 29 # Create rpcuser gid as long as it does not already exist cat /etc/group | cut -d':' -f 1 | grep --quiet rpcuser 2>/dev/null @@ -354,10 +326,8 @@ if [ $1 -eq 0 ] ; then rm -rf /var/lib/nfs/v4recovery fi -%if ! %{defined lifsea_dist} %triggerin -- nfs-utils > 1:2.1.1-3 /bin/systemctl try-restart gssproxy || : -%endif %files %config(noreplace) /etc/nfsmount.conf @@ -390,29 +360,24 @@ fi %{_sbindir}/rpc.gssd %{_sbindir}/sm-notify %{_sbindir}/start-statd -%{!?lifsea_dist:%{_sbindir}/mountstats} -%{?lifsea_dist:%exclude %{_sbindir}/mountstats} -%{!?lifsea_dist:%{_sbindir}/nfsiostat} -%{?lifsea_dist:%exclude %{_sbindir}/nfsiostat} +%{_sbindir}/mountstats +%{_sbindir}/nfsiostat %{_sbindir}/nfsidmap %{_sbindir}/blkmapd %{_sbindir}/nfsconf %{_sbindir}/nfsref -%{!?lifsea_dist:%{_sbindir}/nfsconvert} -%{!?lifsea_dist:%{_sbindir}/nfsdclddb} -%{?lifsea_dist:%exclude %{_sbindir}/nfsdclddb} +%{_sbindir}/nfsconvert +%{_sbindir}/nfsdclddb %{_sbindir}/nfsdcld -%{!?lifsea_dist:%{_sbindir}/nfsdclnts} -%{?lifsea_dist:%exclude %{_sbindir}/nfsdclnts} -%{!?lifsea_dist:%{_sbindir}/rpcctl} -%{?lifsea_dist:%exclude %{_sbindir}/rpcctl} +%{_sbindir}/nfsdclnts +%{_sbindir}/rpcctl %{_libexecdir}/nfsrahead %{_udevrulesdir}/99-nfs.rules %{_mandir}/*/* %{_pkgdir}/*/* %attr(4755,root,root) /sbin/mount.nfs -%{!?lifsea_dist:%attr(755,root,root) %{_libexecdir}/nfs-utils/nfsconvert.sh} +%attr(755,root,root) %{_libexecdir}/nfs-utils/nfsconvert.sh /sbin/mount.nfs4 /sbin/umount.nfs @@ -431,21 +396,21 @@ fi %{_libdir}/libnfsidmap.so %changelog -* Tue Jun 25 2024 Weisson 2.3.3-59.0.4 -- more carefully detect availability of res_querydomain(3). +* Tue May 20 2025 Scott Mayhew 2.3.3-64 +- update rdirplus documentation on nfs(5) man page (RHEL-91253) + +* Fri May 9 2025 Scott Mayhew 2.3.3-63 +- mountstats fixes (RHEL-90242) -* Mon Jan 22 2024 yuanhui 2.3.3-59.0.3 -- LifseaOS: Remove Python dependencies and gssproxy package +* Thu May 8 2025 Scott Mayhew 2.3.3-62 +- nfsiostat fixes (RHEL-90242) -* Thu Jun 29 2023 Ferry Meng 2.3.3-59.0.2 -- Fix NFSv4 export of tmpfs filesystems -- move estab/rmtab into libraries for compiling +* Mon Apr 28 2025 Scott Mayhew 2.3.3-61 +- gssd: unconditionally use krb5_get_init_creds_opt_alloc (RHEL-62422) +- gssd: do not use krb5_cc_initialize (RHEL-62422) -* Thu May 25 2023 Weitao Zhou 2.3.3-59.0.1 -- use extern in header files when declaring global variables for compatible gcc10 build -- allow compilation to succeed with -fno-common -- Add libuuid-devel buildrequires (wb-zh951434@alibaba-inc.com) -- Disable v4client on loongarch platform (liwei.glw@alibaba-inc.com) +* Tue Apr 15 2025 Scott Mayhew 2.3.3-60 +- gssd.man: add documentation for use-gss-proxy (RHEL-13085) * Thu Jan 12 2023 Steve Dickson 2.3.3-59 - Covscan Scan: Wrong Check of Return Value (bz 2151966) -- Gitee From 1fa946589cbc8cac0efbbb7708747b459922f282 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Wed, 18 May 2022 14:19:50 +0800 Subject: [PATCH 2/8] [gcc10] use extern in header files when declaring global variables to --- 1001-nfs-utils-gcc10.patch | 68 ++++++++++++++++++++++++++++++++++++++ nfs-utils.spec | 10 +++++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 1001-nfs-utils-gcc10.patch diff --git a/1001-nfs-utils-gcc10.patch b/1001-nfs-utils-gcc10.patch new file mode 100644 index 0000000..609b063 --- /dev/null +++ b/1001-nfs-utils-gcc10.patch @@ -0,0 +1,68 @@ +From 80a9ea81f54fb6bd2147fa247cb06515990deb19 Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Tue, 26 Apr 2022 16:53:23 +0800 +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 +--- + support/export/v4root.c | 2 -- + utils/statd/statd.c | 2 ++ + utils/statd/statd.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/support/export/v4root.c b/support/export/v4root.c +index 4d33117..3654bd7 100644 +--- a/support/export/v4root.c ++++ b/support/export/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..665b0fe 100644 +--- a/utils/statd/statd.c ++++ b/utils/statd/statd.c +@@ -68,6 +68,8 @@ 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 **); + #endif +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 + +-- +2.18.4 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 62d3691..deab524 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: 64%{?dist} +Release: 64%{anolis_release}%{?dist} Epoch: 1 # group all 32bit related archs @@ -125,6 +126,10 @@ 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 +# End: Anolis customized patches + Provides: exportfs = %{epoch}:%{version}-%{release} Provides: nfsstat = %{epoch}:%{version}-%{release} Provides: showmount = %{epoch}:%{version}-%{release} @@ -396,6 +401,9 @@ fi %{_libdir}/libnfsidmap.so %changelog +* Mon Sep 15 2025 Weitao Zhou 2.3.3-64.0.1 +- use extern in header files when declaring global variables for compatible gcc10 build + * Tue May 20 2025 Scott Mayhew 2.3.3-64 - update rdirplus documentation on nfs(5) man page (RHEL-91253) -- Gitee From 9e9d2924f52eb0b38ab3cd06fdab51bf442773b6 Mon Sep 17 00:00:00 2001 From: songmingliang Date: Wed, 18 May 2022 14:24:40 +0800 Subject: [PATCH 3/8] Allow compilation to succeed with -fno-common --- ...mpilation-to-succeed-with-fno-common.patch | 66 +++++++++++++++++++ nfs-utils.spec | 3 + 2 files changed, 69 insertions(+) create mode 100644 1002-Allow-compilation-to-succeed-with-fno-common.patch 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 0000000..a9c7dc9 --- /dev/null +++ b/1002-Allow-compilation-to-succeed-with-fno-common.patch @@ -0,0 +1,66 @@ +From 050d33d0c81fe82d004fe75b25415232e110756e Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Tue, 26 Apr 2022 17:02:57 +0800 +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/nfsdcld/cld-internal.h | 11 +++++------ + utils/nfsdcld/nfsdcld.c | 6 ++++++ + 2 files changed, 11 insertions(+), 6 deletions(-) + +diff --git a/utils/nfsdcld/cld-internal.h b/utils/nfsdcld/cld-internal.h +index 05f01be..e8216c9 100644 +--- a/utils/nfsdcld/cld-internal.h ++++ b/utils/nfsdcld/cld-internal.h +@@ -35,10 +35,9 @@ 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' }, +-- +2.18.4 + diff --git a/nfs-utils.spec b/nfs-utils.spec index deab524..ea15966 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -128,6 +128,8 @@ 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} @@ -403,6 +405,7 @@ fi %changelog * Mon Sep 15 2025 Weitao Zhou 2.3.3-64.0.1 - use extern in header files when declaring global variables for compatible gcc10 build +- allow compilation to succeed with -fno-common * Tue May 20 2025 Scott Mayhew 2.3.3-64 - update rdirplus documentation on nfs(5) man page (RHEL-91253) -- Gitee From 2a59a893e9a739cfc54ea135cec0b41075028a3d Mon Sep 17 00:00:00 2001 From: Zhao Hang Date: Wed, 14 Dec 2022 17:41:21 +0800 Subject: [PATCH 4/8] spec: add buildrequires Signed-off-by: Zhao Hang --- nfs-utils.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nfs-utils.spec b/nfs-utils.spec index ea15966..9a58ddf 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -160,6 +160,7 @@ BuildRequires: sqlite-devel BuildRequires: python3-devel BuildRequires: systemd BuildRequires: rpcgen +BuildRequires: libuuid-devel Requires(pre): shadow-utils >= 4.0.3-25 Requires(pre): util-linux Requires(pre): coreutils @@ -406,6 +407,7 @@ fi * Mon Sep 15 2025 Weitao Zhou 2.3.3-64.0.1 - use extern in header files when declaring global variables for compatible gcc10 build - allow compilation to succeed with -fno-common +- Add libuuid-devel buildrequires (wb-zh951434@alibaba-inc.com) * Tue May 20 2025 Scott Mayhew 2.3.3-64 - update rdirplus documentation on nfs(5) man page (RHEL-91253) -- Gitee From 45ff61642a9e41b43661b995066ad9d0d83b8a4f Mon Sep 17 00:00:00 2001 From: Liwei Ge Date: Fri, 13 Jan 2023 22:38:18 +0800 Subject: [PATCH 5/8] nfs: disable v4client for loongarch --- 0001-nfs-disable-v4client-for-loongarch.patch | 27 +++++++++++++++++++ nfs-utils.spec | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 0001-nfs-disable-v4client-for-loongarch.patch diff --git a/0001-nfs-disable-v4client-for-loongarch.patch b/0001-nfs-disable-v4client-for-loongarch.patch new file mode 100644 index 0000000..4f2c013 --- /dev/null +++ b/0001-nfs-disable-v4client-for-loongarch.patch @@ -0,0 +1,27 @@ +From f0545ed4469160964d4c2755bda71194423ca9c5 Mon Sep 17 00:00:00 2001 +From: Liwei Ge +Date: Thu, 2 Mar 2023 13:49:23 +0800 +Subject: [PATCH] nfs: disable v4client for loongarch + +Signed-off-by: Bo Ren +--- + support/export/v4clients.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/support/export/v4clients.c b/support/export/v4clients.c +index 6451a16..c6c73a8 100644 +--- a/support/export/v4clients.c ++++ b/support/export/v4clients.c +@@ -25,6 +25,9 @@ static int clients_fd = -1; + void v4clients_init(void) + { + struct stat sb; ++ #ifdef __loongarch__ ++ return; ++ #endif + + if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || + !S_ISDIR(sb.st_mode)) +-- +2.27.0 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 9a58ddf..6b6b5ea 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -130,6 +130,7 @@ Patch104: nfs-utils-2.3.1-systemd-svcgssd-removed.patch Patch1001: 1001-nfs-utils-gcc10.patch # backport patch from upstream Patch1002: 1002-Allow-compilation-to-succeed-with-fno-common.patch +Patch1003: 0001-nfs-disable-v4client-for-loongarch.patch # End: Anolis customized patches Provides: exportfs = %{epoch}:%{version}-%{release} @@ -408,6 +409,7 @@ fi - use extern in header files when declaring global variables for compatible gcc10 build - allow compilation to succeed with -fno-common - Add libuuid-devel buildrequires (wb-zh951434@alibaba-inc.com) +- Disable v4client on loongarch platform (liwei.glw@alibaba-inc.com) * Tue May 20 2025 Scott Mayhew 2.3.3-64 - update rdirplus documentation on nfs(5) man page (RHEL-91253) -- Gitee From 011948033f5a480903a436f40a07fff7010f70cf Mon Sep 17 00:00:00 2001 From: Ferry Meng Date: Thu, 29 Jun 2023 14:18:34 +0800 Subject: [PATCH 6/8] add NFSv4 support for the export of tmpfs. ANBZ: #5614 nfsv4 doesn't support tmpfs export because of lacking fsid/uuid, which needs to be fixed. backport note: some parts (e.g exportd) are currently missing from the code, this patch includes manual modification. Signed-off-by: Ferry Meng --- ...ix-NFSv4-export-of-tmpfs-filesystems.patch | 223 ++++++++++++++++++ ...ion-of-etab-and-rmtab-into-libraries.patch | 138 +++++++++++ ....4-Remove-force-arg-from-cache_flush.patch | 136 +++++++++++ nfs-utils.spec | 6 + 4 files changed, 503 insertions(+) create mode 100644 nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch create mode 100644 nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch create mode 100644 nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch diff --git a/nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch b/nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch new file mode 100644 index 0000000..ffa206c --- /dev/null +++ b/nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch @@ -0,0 +1,223 @@ +From 49235a6f1290626333ab4b2af915805f71c60081 Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Sat, 22 May 2021 11:03:31 -0400 +Subject: [PATCH] Fix NFSv4 export of tmpfs filesystems + +Some filesystems cannot be exported without an fsid or uuid. +tmpfs is the main example. + +When mountd (or exportd) creates nfsv4 pseudo-root exports for the path +leading down to an export point it exports each directory without any +fsid or uuid. If one of these directories is on tmpfs, that will fail. + +The net result is that exporting a subdirectory of a tmpfs filesystem +will not work over NFSv4 as the parents within the filesystem cannot be +exported. It will either fail, or fall-back to NFSv3 (depending on the +version of the mount.nfs program). + +To fix this we need to provide an fsid or uuid for these pseudo-root +exports. This patch does that by creating an RFC-4122 V5 compatible +UUID based on an arbitrary seed and the path to the export. + +To check if an export needs a uuid, text_export() is moved from exportfs +to libexport.a, modified slightly and renamed to export_test(). + +backport note: +Currently there isn't exportd, attention. + +Reported-by: Petr Vorel +Reviewed-by: Petr Vorel +Tested-by: Petr Vorel +Signed-off-by: NeilBrown +Signed-off-by: Steve Dickson +Signed-off-by: Ferry Meng +--- + support/export/cache.c | 3 ++- + support/export/export.c | 29 +++++++++++++++++++++++++++++ + support/export/v4root.c | 21 +++++++++++++++++++++ + support/include/exportfs.h | 1 + + utils/exportfs/exportfs.c | 33 +++------------------------------ + utils/mountd/Makefile.am | 2 +- + 6 files changed, 57 insertions(+), 32 deletions(-) + +diff --git a/support/export/cache.c b/support/export/cache.c +index 98d5082..b77b608 100644 +--- a/support/export/cache.c ++++ b/support/export/cache.c +@@ -899,7 +899,8 @@ static int dump_to_cache(int f, char *buf, int buflen, char *domain, + write_secinfo(&bp, &blen, exp, flag_mask); + if (exp->e_uuid == NULL || different_fs) { + char u[16]; +- if (uuid_by_path(path, 0, 16, u)) { ++ if ((exp->e_flags & flag_mask & NFSEXP_FSID) == 0 && ++ uuid_by_path(path, 0, 16, u)) { + qword_add(&bp, &blen, "uuid"); + qword_addhex(&bp, &blen, u, 16); + } +diff --git a/support/export/export.c b/support/export/export.c +index fbe68e8..0c4b617 100644 +--- a/support/export/export.c ++++ b/support/export/export.c +@@ -10,9 +10,11 @@ + #include + #endif + ++#include + #include + #include + #include ++#include + #include + #include + #include +@@ -388,3 +390,30 @@ export_hash(char *str) + + return num % HASH_TABLE_SIZE; + } ++ ++int export_test(struct exportent *eep, int with_fsid) ++{ ++ char *path = eep->e_path; ++ int flags = eep->e_flags | (with_fsid ? NFSEXP_FSID : 0); ++ /* beside max path, buf size should take protocol str into account */ ++ char buf[NFS_MAXPATHLEN+1+64] = { 0 }; ++ char *bp = buf; ++ int len = sizeof(buf); ++ int fd, n; ++ ++ n = snprintf(buf, len, "-test-client- "); ++ bp += n; ++ len -= n; ++ qword_add(&bp, &len, path); ++ if (len < 1) ++ return 0; ++ snprintf(bp, len, " 3 %d 65534 65534 0\n", flags); ++ fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); ++ if (fd < 0) ++ return 0; ++ n = write(fd, buf, strlen(buf)); ++ close(fd); ++ if (n < 0) ++ return 0; ++ return 1; ++} +diff --git a/support/export/v4root.c b/support/export/v4root.c +index 3654bd7..fff7f54 100644 +--- a/support/export/v4root.c ++++ b/support/export/v4root.c +@@ -20,6 +20,7 @@ + + #include + #include ++#include + + #include "xlog.h" + #include "exportfs.h" +@@ -89,6 +90,26 @@ v4root_create(char *path, nfs_export *export) + strncpy(eep.e_path, path, sizeof(eep.e_path)-1); + if (strcmp(path, "/") != 0) + eep.e_flags &= ~NFSEXP_FSID; ++ ++ if (strcmp(path, "/") != 0 && ++ !export_test(&eep, 0)) { ++ /* Need a uuid - base it on path using a fixed seed that ++ * was generated randomly. ++ */ ++ const char seed_s[] = "39c6b5c1-3f24-4f4e-977c-7fe6546b8a25"; ++ uuid_t seed, uuid; ++ char uuid_s[UUID_STR_LEN]; ++ unsigned int i, j; ++ ++ uuid_parse(seed_s, seed); ++ uuid_generate_sha1(uuid, seed, path, strlen(path)); ++ uuid_unparse_upper(uuid, uuid_s); ++ /* strip hyhens */ ++ for (i = j = 0; uuid_s[i]; i++) ++ if (uuid_s[i] != '-') ++ uuid_s[j++] = uuid_s[i]; ++ eep.e_uuid = uuid_s; ++ } + set_pseudofs_security(&eep); + exp = export_create(&eep, 0); + if (exp == NULL) +diff --git a/support/include/exportfs.h b/support/include/exportfs.h +index bfae195..301486b 100644 +--- a/support/include/exportfs.h ++++ b/support/include/exportfs.h +@@ -172,5 +172,6 @@ struct export_features { + + struct export_features *get_export_features(void); + void fix_pseudoflavor_flags(struct exportent *ep); ++int export_test(struct exportent *eep, int with_fsid); + + #endif /* EXPORTFS_H */ +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index c162c03..50fbe6c 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -485,33 +485,6 @@ static int can_test(void) + return 1; + } + +-static int test_export(nfs_export *exp, int with_fsid) +-{ +- char *path = exp->m_export.e_path; +- int flags = exp->m_export.e_flags | (with_fsid ? NFSEXP_FSID : 0); +- /* beside max path, buf size should take protocol str into account */ +- char buf[NFS_MAXPATHLEN+1+64] = { 0 }; +- char *bp = buf; +- int len = sizeof(buf); +- int fd, n; +- +- n = snprintf(buf, len, "-test-client- "); +- bp += n; +- len -= n; +- qword_add(&bp, &len, path); +- if (len < 1) +- return 0; +- snprintf(bp, len, " 3 %d 65534 65534 0\n", flags); +- fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY); +- if (fd < 0) +- return 0; +- n = write(fd, buf, strlen(buf)); +- close(fd); +- if (n < 0) +- return 0; +- return 1; +-} +- + static void + validate_export(nfs_export *exp) + { +@@ -543,12 +516,12 @@ validate_export(nfs_export *exp) + + if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid || + fs_has_fsid) { +- if ( !test_export(exp, 1)) { ++ if ( !export_test(&exp->m_export, 1)) { + xlog(L_ERROR, "%s does not support NFS export", path); + return; + } +- } else if ( !test_export(exp, 0)) { +- if (test_export(exp, 1)) ++ } else if ( !export_test(&exp->m_export, 0)) { ++ if (export_test(&exp->m_export, 1)) + xlog(L_ERROR, "%s requires fsid= for NFS export", path); + else + xlog(L_ERROR, "%s does not support NFS export", path); +diff --git a/utils/mountd/Makefile.am b/utils/mountd/Makefile.am +index c41f06d..dab9f97 100644 +--- a/utils/mountd/Makefile.am ++++ b/utils/mountd/Makefile.am +@@ -19,7 +19,7 @@ mountd_LDADD = ../../support/export/libexport.a \ + ../../support/nfs/libnfs.la \ + ../../support/misc/libmisc.a \ + $(OPTLIBS) \ +- $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) $(LIBTIRPC) ++ $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) -luuid $(LIBTIRPC) + mountd_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \ + -I$(top_builddir)/support/include \ + -I$(top_srcdir)/support/export +-- +2.39.3 + diff --git a/nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch b/nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch new file mode 100644 index 0000000..69bfa6c --- /dev/null +++ b/nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch @@ -0,0 +1,138 @@ +From 930f71a4b69c0342c2afdcbdcdad997c92be8167 Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Sat, 22 May 2021 11:12:11 -0400 +Subject: [PATCH 3/3] Move declaration of etab and rmtab into libraries + +There are two global "struct stat_paths" structures: etab and rmtab. +They are currently needed by some library code so any program which is +linked with that library code needs to declare the structures even if it +doesn't use the functionality. This is clumsy and error-prone. + +Instead: have the library declare the structure and put the definition +in a header file. Now programs only need to know about these structures +if they use the functionality. + +'rmtab' is now declared in libnfs.a (rmtab.c). 'etab' is declared in +export.a (xtab.c). + +Reviewed-by: Petr Vorel +Signed-off-by: NeilBrown +Signed-off-by: Steve Dickson +Signed-off-by: Ferry Meng +--- + support/export/auth.c | 2 -- + support/export/xtab.c | 2 +- + support/include/exportfs.h | 1 + + support/include/nfslib.h | 1 + + support/nfs/rmtab.c | 2 +- + utils/exportfs/exportfs.c | 2 -- + utils/mountd/mountd.c | 3 --- + utils/mountd/rmtab.c | 2 -- + 8 files changed, 4 insertions(+), 11 deletions(-) + +diff --git a/support/export/auth.c b/support/export/auth.c +index 73ad6f7..318d165 100644 +--- a/support/export/auth.c ++++ b/support/export/auth.c +@@ -41,8 +41,6 @@ static nfs_client my_client; + + extern int use_ipaddr; + +-extern struct state_paths etab; +- + /* + void + auth_init(void) +diff --git a/support/export/xtab.c b/support/export/xtab.c +index 1e1d679..4ca7e91 100644 +--- a/support/export/xtab.c ++++ b/support/export/xtab.c +@@ -27,7 +27,7 @@ + #include "misc.h" + + static char state_base_dirname[PATH_MAX] = NFS_STATEDIR; +-extern struct state_paths etab; ++struct state_paths etab; + + int v4root_needed; + static void cond_rename(char *newfile, char *oldfile); +diff --git a/support/include/exportfs.h b/support/include/exportfs.h +index 301486b..400805d 100644 +--- a/support/include/exportfs.h ++++ b/support/include/exportfs.h +@@ -145,6 +145,7 @@ nfs_export * export_create(struct exportent *, int canonical); + void exportent_release(struct exportent *); + void export_freeall(void); + ++extern struct state_paths etab; + int xtab_export_read(void); + int xtab_export_write(void); + +diff --git a/support/include/nfslib.h b/support/include/nfslib.h +index ab8b2bf..90a27d7 100644 +--- a/support/include/nfslib.h ++++ b/support/include/nfslib.h +@@ -104,6 +104,7 @@ void dupexportent(struct exportent *dst, + struct exportent *src); + int updateexportent(struct exportent *eep, char *options); + ++extern struct state_paths rmtab; + int setrmtabent(char *type); + struct rmtabent * getrmtabent(int log, long *pos); + void putrmtabent(struct rmtabent *xep, long *pos); +diff --git a/support/nfs/rmtab.c b/support/nfs/rmtab.c +index 2ecb2cc..d30e625 100644 +--- a/support/nfs/rmtab.c ++++ b/support/nfs/rmtab.c +@@ -33,7 +33,7 @@ + + static FILE *rmfp = NULL; + +-extern struct state_paths rmtab; ++struct state_paths rmtab; + + int + setrmtabent(char *type) +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index dd19776..2957f41 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -51,8 +51,6 @@ static void release_lockfile(void); + static const char *lockfile = EXP_LOCKFILE; + static int _lockfd = -1; + +-struct state_paths etab; +- + /* + * If we aren't careful, changes made by exportfs can be lost + * when multiple exports process run at once: +diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c +index 2b34237..93d9248 100644 +--- a/utils/mountd/mountd.c ++++ b/utils/mountd/mountd.c +@@ -42,9 +42,6 @@ int reverse_resolve = 0; + int manage_gids; + int use_ipaddr = -1; + +-struct state_paths etab; +-struct state_paths rmtab; +- + /* PRC: a high-availability callout program can be specified with -H + * When this is done, the program will receive callouts whenever clients + * send mount or unmount requests -- the callout is not needed for 2.6 kernel */ +diff --git a/utils/mountd/rmtab.c b/utils/mountd/rmtab.c +index 3ae0dbb..fdaafbc 100644 +--- a/utils/mountd/rmtab.c ++++ b/utils/mountd/rmtab.c +@@ -28,8 +28,6 @@ + + extern int reverse_resolve; + +-extern struct state_paths rmtab; +- + /* If new path is a link do not destroy it but place the + * file where the link points. + */ +-- +2.39.3 + diff --git a/nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch b/nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch new file mode 100644 index 0000000..ebfa5ad --- /dev/null +++ b/nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch @@ -0,0 +1,136 @@ +From a0efbb254f6f8703bc4bcaf6b49d49e1a3e7d90f Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Sat, 22 May 2021 11:06:13 -0400 +Subject: [PATCH] Remove 'force' arg from cache_flush() + +Since v4.17 the timestamp written to 'flush' is ignored, +so there isn't much point choosing too precisely. + +For kernels since v4.3-rc3-13-g778620364ef5 it is safe +to write 1 second beyond the current time. + +For earlier kernels, nothing is really safe (even the current +behaviour), but writing one second beyond the current time isn't too bad +in the unlikely case the people use a new nfs-utils on a 5 year old +kernel. + +This remove a dependency for libnfs.a on 'etab' being declare, +so svcgssd no longer needs to declare it. + +Reviewed-by: Petr Vorel +Signed-off-by: NeilBrown +Signed-off-by: Steve Dickson +Signed-off-by: Ferry Meng +--- + support/export/auth.c | 2 +- + support/include/nfslib.h | 2 +- + support/nfs/cacheio.c | 17 ++++++++--------- + utils/exportfs/exportfs.c | 4 ++-- + utils/gssd/svcgssd.c | 1 - + 5 files changed, 12 insertions(+), 14 deletions(-) + +diff --git a/support/export/auth.c b/support/export/auth.c +index 73ad6f7..c5e1b5c 100644 +--- a/support/export/auth.c ++++ b/support/export/auth.c +@@ -80,7 +80,7 @@ check_useipaddr(void) + use_ipaddr = 0; + + if (use_ipaddr != old_use_ipaddr) +- cache_flush(1); ++ cache_flush(); + } + + unsigned int +diff --git a/support/include/nfslib.h b/support/include/nfslib.h +index ab8b2bf..bbe8886 100644 +--- a/support/include/nfslib.h ++++ b/support/include/nfslib.h +@@ -130,7 +130,7 @@ int wildmat(char *text, char *pattern); + + int qword_get(char **bpp, char *dest, int bufsize); + int qword_get_int(char **bpp, int *anint); +-void cache_flush(int force); ++void cache_flush(void); + void qword_add(char **bpp, int *lp, char *str); + void qword_addhex(char **bpp, int *lp, char *buf, int blen); + void qword_addint(char **bpp, int *lp, int n); +diff --git a/support/nfs/cacheio.c b/support/nfs/cacheio.c +index 7c4cf37..c0f19cd 100644 +--- a/support/nfs/cacheio.c ++++ b/support/nfs/cacheio.c +@@ -31,8 +31,6 @@ + #include + #include + +-extern struct state_paths etab; +- + void qword_add(char **bpp, int *lp, char *str) + { + char *bp = *bpp; +@@ -212,7 +210,7 @@ int qword_get_uint(char **bpp, unsigned int *anint) + */ + + void +-cache_flush(int force) ++cache_flush(void) + { + struct stat stb; + int c; +@@ -233,12 +231,13 @@ cache_flush(int force) + NULL + }; + now = time(0); +- if (force || +- stat(etab.statefn, &stb) != 0 || +- stb.st_mtime > now) +- stb.st_mtime = time(0); +- +- sprintf(stime, "%ld\n", stb.st_mtime); ++ ++ /* Since v4.16-rc2-3-g3b68e6ee3cbd the timestamp written is ignored. ++ * It is safest always to flush caches if there is any doubt. ++ * For earlier kernels, writing the next second from now is ++ * the best we can do. ++ */ ++ sprintf(stime, "%ld\n", now+1); + for (c=0; cachelist[c]; c++) { + int fd; + sprintf(path, "/proc/net/rpc/%s/flush", cachelist[c]); +diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c +index 50fbe6c..5a2f6ff 100644 +--- a/utils/exportfs/exportfs.c ++++ b/utils/exportfs/exportfs.c +@@ -170,7 +170,7 @@ main(int argc, char **argv) + return 1; + if (optind == argc && ! f_all) { + if (force_flush) { +- cache_flush(1); ++ cache_flush(); + free_state_path_names(&etab); + return 0; + } else { +@@ -216,7 +216,7 @@ main(int argc, char **argv) + unexportfs(argv[i], f_verbose); + } + xtab_export_write(); +- cache_flush(force_flush); ++ cache_flush(); + free_state_path_names(&etab); + + return export_errno; +diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c +index ec49b61..d728eaf 100644 +--- a/utils/gssd/svcgssd.c ++++ b/utils/gssd/svcgssd.c +@@ -63,7 +63,6 @@ + #include "err_util.h" + #include "conffile.h" + +-struct state_paths etab; + + static void + sig_die(int signal) +-- +2.39.3 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 6b6b5ea..67efead 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -126,6 +126,10 @@ 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 +Patch105: nfs-utils-2.5.4-Fix-NFSv4-export-of-tmpfs-filesystems.patch +Patch106: nfs-utils-2.5.4-Remove-force-arg-from-cache_flush.patch +Patch107: nfs-utils-2.5.4-Move-declaration-of-etab-and-rmtab-into-libraries.patch + # Begin: Anolis customized patches Patch1001: 1001-nfs-utils-gcc10.patch # backport patch from upstream @@ -410,6 +414,8 @@ fi - allow compilation to succeed with -fno-common - Add libuuid-devel buildrequires (wb-zh951434@alibaba-inc.com) - Disable v4client on loongarch platform (liwei.glw@alibaba-inc.com) +- Fix NFSv4 export of tmpfs filesystems +- move estab/rmtab into libraries for compiling * Tue May 20 2025 Scott Mayhew 2.3.3-64 - update rdirplus documentation on nfs(5) man page (RHEL-91253) -- Gitee From 10df3ca7460a51480bc8ca650bef2ae63a985aa5 Mon Sep 17 00:00:00 2001 From: yuanhui Date: Fri, 8 Mar 2024 09:52:17 +0800 Subject: [PATCH 7/8] Merge LifseaOS code to anolis8 Signed-off-by: yuanhui --- nfs-utils.spec | 54 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/nfs-utils.spec b/nfs-utils.spec index 67efead..7481a5b 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -1,9 +1,10 @@ %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: 64%{anolis_release}%{?dist} +Release: 64%{anolis_release}%{?dist}%{?lifsea_dist} Epoch: 1 # group all 32bit related archs @@ -13,9 +14,11 @@ Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{v Source1: id_resolver.conf Source2: lockd.conf Source3: 24-nfs-server.conf +%if ! %{defined lifsea_dist} Source4: nfsconvert.py Source5: nfsconvert.sh Source6: nfs-convert.service +%endif # # RHEL 8.0 @@ -155,7 +158,8 @@ Provides: start-statd = %{epoch}:%{version}-%{release} License: MIT and GPLv2 and GPLv2+ and BSD Requires: rpcbind, sed, gawk, grep -Requires: kmod, keyutils, quota, python3-pyyaml +Requires: kmod, keyutils, quota +%{!?lifsea_dist:Requires: python3-pyyaml} BuildRequires: libevent-devel libcap-devel BuildRequires: libtirpc-devel libblkid-devel BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 @@ -173,7 +177,7 @@ Requires(preun): coreutils Requires: libnfsidmap libevent Requires: libtirpc >= 0.2.3-1 libblkid libcap libmount %{?systemd_requires} -Requires: gssproxy => 0.7.0-3 +%{!?lifsea_dist:Requires: gssproxy => 0.7.0-3} %package -n libnfsidmap Summary: NFSv4 User and Group ID Mapping Library @@ -202,6 +206,13 @@ developing programs which use the libnfsidmap library. The nfs-utils package provides various utilities for use with NFS clients and servers. +# To avoid users installing the LifseaOS package in other os +%define common_pre_scripts() \ +if ! grep -q 'ID="lifsea"' /etc/os-release; then \ + echo "This package is only for LifseaOS!" \ + exit 1 \ +fi + %prep %autosetup -p1 @@ -254,9 +265,11 @@ install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/request-key.d mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/scripts install -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/lockd.conf install -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/gssproxy +%if ! %{defined lifsea_dist} install -m 755 %{SOURCE4} $RPM_BUILD_ROOT%{_sbindir}/nfsconvert -install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/%{_libexecdir}/nfs-utils/nfsconvert.sh +install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/%{_libexecdir}/nfs-utils/nfsconvert.sh install -m 644 %{SOURCE6} $RPM_BUILD_ROOT%{_pkgdir}/system +%endif rm -rf $RPM_BUILD_ROOT%{_libdir}/*.{a,la} @@ -274,6 +287,9 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/exports.d %pre +%if %{defined lifsea_dist} +%{common_pre_scripts} +%endif # move files so the running service will have this applied as well for x in gssd idmapd ; do if [ -f /var/lock/subsys/rpc.$x ]; then @@ -281,6 +297,14 @@ for x in gssd idmapd ; do fi done +%if %{defined lifsea_dist} +%pre -n libnfsidmap +%{common_pre_scripts} + +%pre -n libnfsidmap-devel +%{common_pre_scripts} +%endif + %define rpcuser_uid 29 # Create rpcuser gid as long as it does not already exist cat /etc/group | cut -d':' -f 1 | grep --quiet rpcuser 2>/dev/null @@ -339,8 +363,10 @@ if [ $1 -eq 0 ] ; then rm -rf /var/lib/nfs/v4recovery fi +%if ! %{defined lifsea_dist} %triggerin -- nfs-utils > 1:2.1.1-3 /bin/systemctl try-restart gssproxy || : +%endif %files %config(noreplace) /etc/nfsmount.conf @@ -373,24 +399,29 @@ fi %{_sbindir}/rpc.gssd %{_sbindir}/sm-notify %{_sbindir}/start-statd -%{_sbindir}/mountstats -%{_sbindir}/nfsiostat +%{!?lifsea_dist:%{_sbindir}/mountstats} +%{?lifsea_dist:%exclude %{_sbindir}/mountstats} +%{!?lifsea_dist:%{_sbindir}/nfsiostat} +%{?lifsea_dist:%exclude %{_sbindir}/nfsiostat} %{_sbindir}/nfsidmap %{_sbindir}/blkmapd %{_sbindir}/nfsconf %{_sbindir}/nfsref -%{_sbindir}/nfsconvert -%{_sbindir}/nfsdclddb +%{!?lifsea_dist:%{_sbindir}/nfsconvert} +%{!?lifsea_dist:%{_sbindir}/nfsdclddb} +%{?lifsea_dist:%exclude %{_sbindir}/nfsdclddb} %{_sbindir}/nfsdcld -%{_sbindir}/nfsdclnts -%{_sbindir}/rpcctl +%{!?lifsea_dist:%{_sbindir}/nfsdclnts} +%{?lifsea_dist:%exclude %{_sbindir}/nfsdclnts} +%{!?lifsea_dist:%{_sbindir}/rpcctl} +%{?lifsea_dist:%exclude %{_sbindir}/rpcctl} %{_libexecdir}/nfsrahead %{_udevrulesdir}/99-nfs.rules %{_mandir}/*/* %{_pkgdir}/*/* %attr(4755,root,root) /sbin/mount.nfs -%attr(755,root,root) %{_libexecdir}/nfs-utils/nfsconvert.sh +%{!?lifsea_dist:%attr(755,root,root) %{_libexecdir}/nfs-utils/nfsconvert.sh} /sbin/mount.nfs4 /sbin/umount.nfs @@ -416,6 +447,7 @@ fi - Disable v4client on loongarch platform (liwei.glw@alibaba-inc.com) - Fix NFSv4 export of tmpfs filesystems - move estab/rmtab into libraries for compiling +- LifseaOS: Remove Python dependencies and gssproxy package * Tue May 20 2025 Scott Mayhew 2.3.3-64 - update rdirplus documentation on nfs(5) man page (RHEL-91253) -- Gitee From 271bdc074b3f171f1560aa7e6ac92742b6053c64 Mon Sep 17 00:00:00 2001 From: Weisson Date: Tue, 5 Nov 2024 20:46:16 +0800 Subject: [PATCH 8/8] configure.ac: more carefully detect availability of res_querydomain(3) Since glibc 2.2, the function res_querydomain(3) is implemented as a define to `__res_querydomain`. Due to this implementation detail, using `AC_CHECK_LIB` with a symbol name of "res_querydomain" will cause a linking failure and thus fail to detect its availability. This is why right now, we try to detect availability of `__res_querydomain` instead. Unfortunately, this may break on other platforms where there is no `__res_querydomain` but only the function without leading underscores. To fix this, we can perform another `AC_CHECK_LIB([resolv], [res_querydomain], ...)` call in case where the other one was not found and only raise an error if both symbols weren't found. Signed-off-by: Patrick Steinhardt Signed-off-by: Steve Dickson Signed-off-by: Weisson --- download | 2 +- ...-carefully-detect-of-res_querydomain.patch | 41 +++++++++++++++++++ nfs-utils.spec | 2 + 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch diff --git a/download b/download index 529c0bc..a0ac25e 100644 --- a/download +++ b/download @@ -1 +1 @@ -11490e3f85a8676c647fe1bddbf32f99 nfs-utils-2.3.3.tar.xz +b6c9c032995af1c08fea9fbcc1ce33e9 nfs-utils-2.3.3.tar.xz diff --git a/nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch b/nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch new file mode 100644 index 0000000..65f92de --- /dev/null +++ b/nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch @@ -0,0 +1,41 @@ +From 4f91877bb313a35ade44d9dde1fd219035ba1fd9 Mon Sep 17 00:00:00 2001 +From: Patrick Steinhardt +Date: Wed, 27 Feb 2019 11:58:47 -0500 +Subject: [PATCH] configure.ac: more carefully detect availability of + res_querydomain(3) + +Since glibc 2.2, the function res_querydomain(3) is implemented as a +define to `__res_querydomain`. Due to this implementation detail, using +`AC_CHECK_LIB` with a symbol name of "res_querydomain" will cause a +linking failure and thus fail to detect its availability. This is why +right now, we try to detect availability of `__res_querydomain` instead. + +Unfortunately, this may break on other platforms where there is no +`__res_querydomain` but only the function without leading underscores. +To fix this, we can perform another `AC_CHECK_LIB([resolv], +[res_querydomain], ...)` call in case where the other one was not found +and only raise an error if both symbols weren't found. + +Signed-off-by: Patrick Steinhardt +Signed-off-by: Steve Dickson +--- + configure.ac | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 4bf5aea..cb9d921 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -411,7 +411,8 @@ if test "$enable_gss" = yes; then + fi + + dnl libdnsidmap specific checks +-AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain needed)) ++AC_CHECK_LIB([resolv], [__res_querydomain], , ++ AC_CHECK_LIB([resolv], [res_querydomain], , AC_MSG_ERROR(res_querydomain needed))) + + AC_ARG_ENABLE([ldap], + [AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:default=detect@:>@])]) +-- +1.8.3.1 + diff --git a/nfs-utils.spec b/nfs-utils.spec index 7481a5b..669cc15 100644 --- a/nfs-utils.spec +++ b/nfs-utils.spec @@ -138,6 +138,7 @@ Patch1001: 1001-nfs-utils-gcc10.patch # backport patch from upstream Patch1002: 1002-Allow-compilation-to-succeed-with-fno-common.patch Patch1003: 0001-nfs-disable-v4client-for-loongarch.patch +Patch1004: nfs-utils-2.3.4-carefully-detect-of-res_querydomain.patch # End: Anolis customized patches Provides: exportfs = %{epoch}:%{version}-%{release} @@ -448,6 +449,7 @@ fi - Fix NFSv4 export of tmpfs filesystems - move estab/rmtab into libraries for compiling - LifseaOS: Remove Python dependencies and gssproxy package +- more carefully detect availability of res_querydomain(3). * Tue May 20 2025 Scott Mayhew 2.3.3-64 - update rdirplus documentation on nfs(5) man page (RHEL-91253) -- Gitee