[PATCH nfs-utils 02/17] support/export: remove unnecessary static variables in nfsd_fh expkey lookup

Jeff Layton
2026-03-16T15:16:55Z

The prev and mnt variables in the CROSSMOUNT submount iteration loop
only need to persist across iterations of the inner for loop, not
across calls to the function. Convert them from static to local
variables scoped to the outer for loop.
---
support/export/cache.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/support/export/cache.c b/support/export/cache.c
index 6859a55b7ae5c132255b756052c6ddd1734173f0..c052455889481f04631e4ef0e16cd48bc6c11964 100644
--- a/support/export/cache.c
+++ b/support/export/cache.c
@@ -810,7 +810,10 @@ static int nfsd_handle_fh(int f, char *bp, int blen)

/* Now determine export point for this fsid/domain */
for (i=0 ; i < MCL_MAXTYPES; i++) {
+ nfs_export *prev = NULL;
nfs_export *next_exp;
+ void *mnt = NULL;
+
for (exp = exportlist[i].p_head; exp; exp = next_exp) {
char *path;

@@ -820,9 +823,6 @@ static int nfsd_handle_fh(int f, char *bp, int blen)
}

if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT) {
- static nfs_export *prev = NULL;
- static void *mnt = NULL;
-
if (prev == exp) {
/* try a submount */
path = next_mnt(&mnt, exp->m_export.e_path);

--
2.53.0