aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-09-07 16:01:07 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-09-07 17:52:42 -0400
commit47040da3c7524facd542f37ffeadedac4f228601 (patch)
treedafa9db999b5c56b32b85fb86cd67849d5cc94b2 /fs
parent41d058c3ba7bd16c3a91b9ec4d89fb6e7d4b4316 (diff)
NFSv4: Allow security autonegotiation for submounts
In cases where the parent super block was not mounted with a 'sec=' line, allow autonegotiation of security for the submounts. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4client.c3
-rw-r--r--fs/nfs/nfs4namespace.c21
2 files changed, 19 insertions, 5 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index cc80085c4de4..a860ab566d6e 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -1078,7 +1078,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
1078 if (error < 0) 1078 if (error < 0)
1079 goto error; 1079 goto error;
1080 1080
1081 error = nfs4_server_common_setup(server, mntfh, false); 1081 error = nfs4_server_common_setup(server, mntfh,
1082 !(parent_server->flags & NFS_MOUNT_SECFLAVOUR));
1082 if (error < 0) 1083 if (error < 0)
1083 goto error; 1084 goto error;
1084 1085
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c
index cdb0b41a4810..2288cd3c9278 100644
--- a/fs/nfs/nfs4namespace.c
+++ b/fs/nfs/nfs4namespace.c
@@ -11,6 +11,7 @@
11#include <linux/mount.h> 11#include <linux/mount.h>
12#include <linux/namei.h> 12#include <linux/namei.h>
13#include <linux/nfs_fs.h> 13#include <linux/nfs_fs.h>
14#include <linux/nfs_mount.h>
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/sunrpc/clnt.h> 17#include <linux/sunrpc/clnt.h>
@@ -369,21 +370,33 @@ out:
369struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry, 370struct vfsmount *nfs4_submount(struct nfs_server *server, struct dentry *dentry,
370 struct nfs_fh *fh, struct nfs_fattr *fattr) 371 struct nfs_fh *fh, struct nfs_fattr *fattr)
371{ 372{
373 rpc_authflavor_t flavor = server->client->cl_auth->au_flavor;
372 struct dentry *parent = dget_parent(dentry); 374 struct dentry *parent = dget_parent(dentry);
375 struct inode *dir = parent->d_inode;
376 struct qstr *name = &dentry->d_name;
373 struct rpc_clnt *client; 377 struct rpc_clnt *client;
374 struct vfsmount *mnt; 378 struct vfsmount *mnt;
375 379
376 /* Look it up again to get its attributes and sec flavor */ 380 /* Look it up again to get its attributes and sec flavor */
377 client = nfs4_proc_lookup_mountpoint(parent->d_inode, &dentry->d_name, fh, fattr); 381 client = nfs4_proc_lookup_mountpoint(dir, name, fh, fattr);
378 dput(parent); 382 dput(parent);
379 if (IS_ERR(client)) 383 if (IS_ERR(client))
380 return ERR_CAST(client); 384 return ERR_CAST(client);
381 385
382 if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) 386 if (fattr->valid & NFS_ATTR_FATTR_V4_REFERRAL) {
383 mnt = nfs_do_refmount(client, dentry); 387 mnt = nfs_do_refmount(client, dentry);
384 else 388 goto out;
385 mnt = nfs_do_submount(dentry, fh, fattr, client->cl_auth->au_flavor); 389 }
386 390
391 if (client->cl_auth->au_flavor != flavor)
392 flavor = client->cl_auth->au_flavor;
393 else if (!(server->flags & NFS_MOUNT_SECFLAVOUR)) {
394 rpc_authflavor_t new = nfs4_negotiate_security(dir, name);
395 if ((int)new >= 0)
396 flavor = new;
397 }
398 mnt = nfs_do_submount(dentry, fh, fattr, flavor);
399out:
387 rpc_shutdown_client(client); 400 rpc_shutdown_client(client);
388 return mnt; 401 return mnt;
389} 402}