summaryrefslogtreecommitdiffstats
path: root/utils/mountd/cache.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-01 15:22:57 -0400
committerSteve Dickson <steved@redhat.com>2012-05-01 15:29:59 -0400
commit12a31b8011ab258fc726300dcfbb7a03af74adb3 (patch)
tree2f5a3b7ad312ca0be323178037cb74b4b1530ca1 /utils/mountd/cache.c
parent3d7faa0249332e23a2dc2e3e78020ed6bc66036a (diff)
downloadnfs-utils-12a31b8011ab258fc726300dcfbb7a03af74adb3.tar.gz
nfs-utils-12a31b8011ab258fc726300dcfbb7a03af74adb3.tar.xz
nfs-utils-12a31b8011ab258fc726300dcfbb7a03af74adb3.zip
nfsd_fh: if two exports are possible, choose the one without V4ROOT
When nfsd_fh it looking for an export for a particular client and file-handle, it might find two exports for the same path: one with NFSEXP_V4ROOT, one with out. As nfsd_fh calls cache_export_ent to give the export information to the kernel it much choose the same export that auth_authenticate chooses for get_rootfh which it also passes cache_export_ent (via cache_export). i.e. it must choose the non-V4ROOT on where possible. Also change strcmp(foo, bar) to strcmp(foo, bar) == 0 because I have a pathological fear of the former. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mountd/cache.c')
-rw-r--r--utils/mountd/cache.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index b01c0bd..0af6404 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;
+ }
}
}
}