diff mbox

[5/8] mountd: Don't export unmounted exports to NFSv4

Message ID 20160714022643.5874.38987.stgit@noble (mailing list archive)
State New, archived
Headers show

Commit Message

NeilBrown July 14, 2016, 2:26 a.m. UTC
An export point with the "mountpoint" option should not be exported
if it isn't a mount point.
For NFSv3, this is handled primarily by failing the MOUNT request.
For NFSv4, we must ensure a lookup from the pseduo-root fails too.

This means nfsd_export must check for the 'mountpoint' option and handle
it correctly.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 utils/mountd/cache.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index f33f66640c6c..19e7607e4fb1 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -1321,7 +1321,12 @@  static void nfsd_export(int f)
 	found = lookup_export(dom, path, ai);
 
 	if (found) {
-		if (dump_to_cache(f, buf, sizeof(buf), dom, path, &found->m_export) < 0) {
+		if (found->m_export.e_mountpoint &&
+		    !is_mountpoint(found->m_export.e_mountpoint[0]?
+				   found->m_export.e_mountpoint:
+				   found->m_export.e_path))
+			dump_to_cache(f, buf, sizeof(buf), dom, path, NULL);
+		else if (dump_to_cache(f, buf, sizeof(buf), dom, path, &found->m_export) < 0) {
 			xlog(L_WARNING,
 			     "Cannot export %s, possibly unsupported filesystem"
 			     " or fsid= required", path);