[RFC PATCH 2/2] exportfs: vet exports for subtree checking when testing the export fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a proposed kernel patch that would allow filesystems (such as
NFS) to opt out of subtree checking when they are exported. We do want
to warn people at export time however if that doesn't work. If we issued
a test_export that fails and don't have NFSEXP_NOSUBTREECHECK already set
in it, then try it again with that set. If that works then we know that
the filesystem requires NFSEXP_NOSUBTREECHECK be set.

Cc: Neil Brown <neilb@xxxxxxx>
Signed-off-by: Jeff Layton <jeff.layton@xxxxxxxxxxxxxxx>
---
 utils/exportfs/exportfs.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index cac01fc25f9a..1b704e85c024 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -557,6 +557,20 @@ static int test_export(char *path, int opts)
 }
 
 static void
+validate_subtree_check(nfs_export *exp)
+{
+	char *path = exp->m_export.e_path;
+
+	if (!(exp->m_export.e_flags & NFSEXP_NOSUBTREECHECK)) {
+		if (test_export(path, exp->m_export.e_flags | NFSEXP_NOSUBTREECHECK)) {
+			xlog(L_ERROR, "%s does not support subtree checking", path);
+			return;
+		}
+	}
+	xlog(L_ERROR, "%s does not support NFS export", path);
+}
+
+static void
 validate_export(nfs_export *exp)
 {
 	/* Check that the given export point is potentially exportable.
@@ -587,16 +601,13 @@ validate_export(nfs_export *exp)
 
 	if ((exp->m_export.e_flags & NFSEXP_FSID) || exp->m_export.e_uuid ||
 	    fs_has_fsid) {
-		if ( !test_export(path, exp->m_export.e_flags)) {
-			xlog(L_ERROR, "%s does not support NFS export", path);
-			return;
-		}
-	} else if ( ! test_export(path, exp->m_export.e_flags)) {
+		if (!test_export(path, exp->m_export.e_flags))
+			validate_subtree_check(exp);
+	} else if (!test_export(path, exp->m_export.e_flags)) {
 		if (test_export(path, exp->m_export.e_flags & NFSEXP_FSID))
 			xlog(L_ERROR, "%s requires fsid= for NFS export", path);
 		else
-			xlog(L_ERROR, "%s does not support NFS export", path);
-		return;
+			validate_subtree_check(exp);
 
 	}
 }
-- 
2.4.3

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



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux