From: Scott Mayhew <smayhew@redhat.com>
Date: Sun, 8 Dec 2024 06:08:53 -0500
Subject: exports: Fix referrals when --enable-junction=no
Origin: https://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commit;h=371929c8f0b5eb9aae1a23cc273413b9f4c0165e
Bug-Debian: https://bugs.debian.org/1083098
Bug-Debian: https://bugs.debian.org/1035908

Commit 15dc0bea ("exportd: Moved cache upcalls routines into
libexport.a") caused write_fsloc() to be elided when junction support is
disabled. Remove the not needed #ifdef HAVE_JUNCTION_SUPPORT which
blocks the referrals from working when --enable-junction=no is set.
(only the #ifdef HAVE_JUNCTION_SUPPORT should be around actual
junction code).

Fixes: 15dc0bea ("exportd: Moved cache upcalls routines into libexport.a")
Link: https://bugs.debian.org/1035908
Link: https://bugs.debian.org/1083098

Reviewed-by: Roland Mainz <roland.mainz@nrubsig.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 support/export/cache.c | 7 -------
 1 file changed, 7 deletions(-)

--- a/support/export/cache.c
+++ b/support/export/cache.c
@@ -33,10 +33,7 @@
 #include "export.h"
 #include "pseudoflavors.h"
 #include "xcommon.h"
-
-#ifdef HAVE_JUNCTION_SUPPORT
 #include "fsloc.h"
-#endif
 
 #ifdef USE_BLKID
 #include "blkid/blkid.h"
@@ -908,7 +905,6 @@ out:
 	xlog(D_CALL, "nfsd_fh: found %p path %s", found, found ? found->e_path : NULL);
 }
 
-#ifdef HAVE_JUNCTION_SUPPORT
 static void write_fsloc(char **bp, int *blen, struct exportent *ep)
 {
 	struct servers *servers;
@@ -931,7 +927,6 @@ static void write_fsloc(char **bp, int *
 	qword_addint(bp, blen, servers->h_referral);
 	release_replicas(servers);
 }
-#endif
 static void write_secinfo(char **bp, int *blen, struct exportent *ep, int flag_mask)
 {
 	struct sec_entry *p;
@@ -975,9 +970,7 @@ static int dump_to_cache(int f, char *bu
 		qword_addint(&bp, &blen, exp->e_anongid);
 		qword_addint(&bp, &blen, exp->e_fsid);
 
-#ifdef HAVE_JUNCTION_SUPPORT
 		write_fsloc(&bp, &blen, exp);
-#endif
 		write_secinfo(&bp, &blen, exp, flag_mask);
 		if (exp->e_uuid == NULL || different_fs) {
 			char u[16];
