@@ -74,4 +74,6 @@
#define NFS_MOUNT_LOCAL_FLOCK 0x100000
#define NFS_MOUNT_LOCAL_FCNTL 0x200000
+#define NFS_MOUNT_NOACCESSCHECK 0x400000
+
#endif
@@ -2165,6 +2165,22 @@
struct nfs_access_entry cache;
int status;
+ if (NFS_SERVER(inode)->flags & NFS_MOUNT_NOACCESSCHECK) {
+ /*
+ * We could also check
+ * NFS_SERVER(inode)->client->cl_auth->au_ops->au_flavor
+ * to see if this is RPC_AUTH_UNIX, which is the only
+ * auth flavor where this makes sense, but that's way
+ * too much pointer chasing.
+ */
+ if (cred->cr_uid != 0) {
+ status = nfs_revalidate_inode(NFS_SERVER(inode), inode);
+ if (status == 0)
+ status = generic_permission(inode, mask);
+ return status;
+ }
+ }
+
status = nfs_access_get_cached(inode, cred, &cache);
if (status == 0)
goto out;
@@ -91,6 +91,7 @@
Opt_resvport, Opt_noresvport,
Opt_fscache, Opt_nofscache,
Opt_migration, Opt_nomigration,
+ Opt_accesscheck, Opt_noaccesscheck,
/* Mount options that take integer arguments */
Opt_port,
@@ -152,6 +153,8 @@
{ Opt_nofscache, "nofsc" },
{ Opt_migration, "migration" },
{ Opt_nomigration, "nomigration" },
+ { Opt_accesscheck, "accesscheck" },
+ { Opt_noaccesscheck, "noaccesscheck" },
{ Opt_port, "port=%s" },
{ Opt_rsize, "rsize=%s" },
@@ -635,6 +638,7 @@
{ NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
{ NFS_MOUNT_UNSHARED, ",nosharecache", "" },
{ NFS_MOUNT_NORESVPORT, ",noresvport", "" },
+ { NFS_MOUNT_NOACCESSCHECK, ",noaccesscheck", "" },
{ 0, NULL, NULL }
};
const struct proc_nfs_info *nfs_infop;
@@ -1261,6 +1265,12 @@
case Opt_nomigration:
mnt->options &= NFS_OPTION_MIGRATION;
break;
+ case Opt_accesscheck:
+ mnt->flags &= ~NFS_MOUNT_NOACCESSCHECK;
+ break;
+ case Opt_noaccesscheck:
+ mnt->flags |= NFS_MOUNT_NOACCESSCHECK;
+ break;
/*
* options that take numeric values