From: NeilBrown Date: Tue, 1 May 2012 19:14:43 +0000 (-0400) Subject: lookup_export: really prefer nonV4ROOT exports. X-Git-Tag: nfs-utils-1-2-6-rc7~11 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=8ed7383f1b1766f12a3ad3d6259e5e9e37b64727;p=nfs-utils.git 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 --- 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) ||