diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2011-03-24 13:12:30 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-03-24 13:52:42 -0400 |
commit | 7ebb931598cd95cccea10d4bc4c0123a464ea565 (patch) | |
tree | dec1af6eefdbbc3ce42346d7c6d407088eaf509e /fs/nfs/nfs4proc.c | |
parent | 5a5ea0d485c9715c86bf858bbdc5f6d373b3db88 (diff) |
NFS: use secinfo when crossing mountpoints
A submount may use different security than the parent
mount does. We should figure out what sec flavor the
submount uses at mount time.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r-- | fs/nfs/nfs4proc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 0b8bae119976..563463777d9d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -87,6 +87,8 @@ static int nfs4_map_errors(int err) | |||
87 | switch (err) { | 87 | switch (err) { |
88 | case -NFS4ERR_RESOURCE: | 88 | case -NFS4ERR_RESOURCE: |
89 | return -EREMOTEIO; | 89 | return -EREMOTEIO; |
90 | case -NFS4ERR_WRONGSEC: | ||
91 | return -EPERM; | ||
90 | case -NFS4ERR_BADOWNER: | 92 | case -NFS4ERR_BADOWNER: |
91 | case -NFS4ERR_BADNAME: | 93 | case -NFS4ERR_BADNAME: |
92 | return -EINVAL; | 94 | return -EINVAL; |
@@ -2383,6 +2385,16 @@ static int _nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, | |||
2383 | return status; | 2385 | return status; |
2384 | } | 2386 | } |
2385 | 2387 | ||
2388 | void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr, struct nfs_fh *fh) | ||
2389 | { | ||
2390 | memset(fh, 0, sizeof(struct nfs_fh)); | ||
2391 | fattr->fsid.major = 1; | ||
2392 | fattr->valid |= NFS_ATTR_FATTR_TYPE | NFS_ATTR_FATTR_MODE | | ||
2393 | NFS_ATTR_FATTR_NLINK | NFS_ATTR_FATTR_FSID | NFS_ATTR_FATTR_MOUNTPOINT; | ||
2394 | fattr->mode = S_IFDIR | S_IRUGO | S_IXUGO; | ||
2395 | fattr->nlink = 2; | ||
2396 | } | ||
2397 | |||
2386 | static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name, | 2398 | static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name, |
2387 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 2399 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) |
2388 | { | 2400 | { |
@@ -2392,6 +2404,8 @@ static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qst | |||
2392 | err = nfs4_handle_exception(NFS_SERVER(dir), | 2404 | err = nfs4_handle_exception(NFS_SERVER(dir), |
2393 | _nfs4_proc_lookup(clnt, dir, name, fhandle, fattr), | 2405 | _nfs4_proc_lookup(clnt, dir, name, fhandle, fattr), |
2394 | &exception); | 2406 | &exception); |
2407 | if (err == -EPERM) | ||
2408 | nfs_fixup_secinfo_attributes(fattr, fhandle); | ||
2395 | } while (exception.retry); | 2409 | } while (exception.retry); |
2396 | return err; | 2410 | return err; |
2397 | } | 2411 | } |