From: Neil Brown <neilb@suse.de>
To: Steve Dickson <steved@redhat.com>
Cc: linux-nfs@vger.kernel.org, NeilBrown <neilb@suse.de>
Subject: [PATCH 3/6] nfsd_fh: if two exports are possible, choose the one without V4ROOT
Date: Tue, 24 Apr 2012 15:46:38 +1000 [thread overview]
Message-ID: <20120424054638.20130.88078.stgit@notabene.brown> (raw)
In-Reply-To: <20120424054003.20130.16209.stgit@notabene.brown>
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>
---
utils/mountd/cache.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
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;
+ }
}
}
}
next prev parent reply other threads:[~2012-04-24 5:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 5:46 [PATCH 0/6] fix some problems with v4root handling in mountd Neil Brown
2012-04-24 5:46 ` [PATCH 2/6] auth_authenticate_newcache: prefer non-V4ROOT export over V4ROOT exports Neil Brown
2012-04-24 5:46 ` [PATCH 5/6] v4root: set the time-to-live for V4ROOT exports to the DEFAULT Neil Brown
2012-04-24 5:46 ` [PATCH 4/6] v4set_root: force "fsid=0" for all exports of '/' Neil Brown
2012-04-24 22:03 ` J. Bruce Fields
2012-04-24 5:46 ` Neil Brown [this message]
2012-04-24 5:46 ` [PATCH 1/6] lookup_export: really prefer nonV4ROOT exports Neil Brown
2012-04-24 5:46 ` [PATCH 6/6] v4_root_add_parents: remove a possible buffer overflow Neil Brown
2012-04-24 22:05 ` [PATCH 0/6] fix some problems with v4root handling in mountd J. Bruce Fields
2012-05-01 19:33 ` Steve Dickson
2012-05-02 1:23 ` NeilBrown
2012-05-02 10:32 ` Steve Dickson
2012-05-02 23:08 ` NeilBrown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120424054638.20130.88078.stgit@notabene.brown \
--to=neilb@suse.de \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).