summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-01 15:14:43 -0400
committerSteve Dickson <steved@redhat.com>2012-05-01 15:29:59 -0400
commit8ed7383f1b1766f12a3ad3d6259e5e9e37b64727 (patch)
tree32d0289b24e8cfdd3685f0e3c02caf58500007ca
parentef6462bd655e5ad9bca537e5f4ecff8df41ff1f2 (diff)
downloadnfs-utils-8ed7383f1b1766f12a3ad3d6259e5e9e37b64727.tar.gz
nfs-utils-8ed7383f1b1766f12a3ad3d6259e5e9e37b64727.tar.xz
nfs-utils-8ed7383f1b1766f12a3ad3d6259e5e9e37b64727.zip
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 <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/mountd/cache.c10
1 files 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) ||