]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
lookup_export: really prefer nonV4ROOT exports.
authorNeilBrown <neilb@suse.de>
Tue, 1 May 2012 19:14:43 +0000 (15:14 -0400)
committerSteve Dickson <steved@redhat.com>
Tue, 1 May 2012 19:29:59 +0000 (15:29 -0400)
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>
utils/mountd/cache.c

index ac9cdbd2e0ed30fedcd03a368e1f79797cda3f35..b01c0bdb4e944286a03664c33c53bb922999e04a 100644 (file)
@@ -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) ||