X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=utils%2Fmountd%2Fcache.c;h=47c8691585332ba5132a43cae211eca571fd501b;hb=b46c04422f2a4ae76b89bf43a21839b1c5a1fc79;hp=ac9cdbd2e0ed30fedcd03a368e1f79797cda3f35;hpb=ab74900ff59ef54e2ef7e2523b2f6f1ea8e695c8;p=nfs-utils.git diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c index ac9cdbd..47c8691 100644 --- a/utils/mountd/cache.c +++ b/utils/mountd/cache.c @@ -596,11 +596,20 @@ static void nfsd_fh(FILE *f) found_path = strdup(path); if (found_path == NULL) goto out; - } else if (strcmp(found->e_path, exp->m_export.e_path) + } else if (strcmp(found->e_path, exp->m_export.e_path) != 0 && !subexport(found, &exp->m_export)) { xlog(L_WARNING, "%s and %s have same filehandle for %s, using first", found_path, path, dom); + } else { + /* same path, if one is V4ROOT, choose the other */ + if (found->e_flags & NFSEXP_V4ROOT) { + found = &exp->m_export; + free(found_path); + found_path = strdup(path); + if (found_path == NULL) + goto out; + } } } } @@ -772,10 +781,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) || @@ -1064,6 +1077,7 @@ static void nfsd_export(FILE *f) goto out; ai = client_resolve(tmp->ai_addr); freeaddrinfo(tmp); + if (!ai) goto out; }