From 8ed7383f1b1766f12a3ad3d6259e5e9e37b64727 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Tue, 1 May 2012 15:14:43 -0400 Subject: [PATCH] lookup_export: really prefer nonV4ROOT exports. lookup_export() claims to "Always prefer non-V4ROOT mounts" (meaning "exports") but actually prefers V4ROOT exports - once it has 'found' one it will never replace it. So fix that inversion, and add code so that it proactively prefers a non-V4ROOT whether it is found before or after a V4ROOT. Signed-off-by: NeilBrown Signed-off-by: Steve Dickson --- utils/mountd/cache.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index ac9cdbd..b01c0bd 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -772,10 +772,14 @@ lookup_export(char *dom, char *path, struct addrinfo *ai) found_type = i; continue; } - - /* Always prefer non-V4ROOT mounts */ - if (found->m_export.e_flags & NFSEXP_V4ROOT) + /* Always prefer non-V4ROOT exports */ + if (exp->m_export.e_flags & NFSEXP_V4ROOT) continue; + if (found->m_export.e_flags & NFSEXP_V4ROOT) { + found = exp; + found_type = i; + continue; + } /* If one is a CROSSMOUNT, then prefer the longest path */ if (((found->m_export.e_flags & NFSEXP_CROSSMOUNT) || -- 2.39.2