diff options
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/lockd.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfs2acl.c | 7 | ||||
-rw-r--r-- | fs/nfsd/nfs3acl.c | 5 | ||||
-rw-r--r-- | fs/nfsd/nfs3proc.c | 8 | ||||
-rw-r--r-- | fs/nfsd/nfs4proc.c | 23 | ||||
-rw-r--r-- | fs/nfsd/nfs4state.c | 6 | ||||
-rw-r--r-- | fs/nfsd/nfsfh.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfsproc.c | 8 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 115 |
9 files changed, 92 insertions, 84 deletions
diff --git a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c index 9e4a568a5013..6b6225ac4926 100644 --- a/fs/nfsd/lockd.c +++ b/fs/nfsd/lockd.c | |||
@@ -35,7 +35,7 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp) | |||
35 | fh.fh_export = NULL; | 35 | fh.fh_export = NULL; |
36 | 36 | ||
37 | exp_readlock(); | 37 | exp_readlock(); |
38 | nfserr = nfsd_open(rqstp, &fh, S_IFREG, MAY_LOCK, filp); | 38 | nfserr = nfsd_open(rqstp, &fh, S_IFREG, NFSD_MAY_LOCK, filp); |
39 | fh_put(&fh); | 39 | fh_put(&fh); |
40 | rqstp->rq_client = NULL; | 40 | rqstp->rq_client = NULL; |
41 | exp_readunlock(); | 41 | exp_readunlock(); |
diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 1c3b7654e966..4e3219e84116 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c | |||
@@ -40,7 +40,8 @@ static __be32 nfsacld_proc_getacl(struct svc_rqst * rqstp, | |||
40 | dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); | 40 | dprintk("nfsd: GETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); |
41 | 41 | ||
42 | fh = fh_copy(&resp->fh, &argp->fh); | 42 | fh = fh_copy(&resp->fh, &argp->fh); |
43 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) | 43 | nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
44 | if (nfserr) | ||
44 | RETURN_STATUS(nfserr); | 45 | RETURN_STATUS(nfserr); |
45 | 46 | ||
46 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) | 47 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) |
@@ -107,7 +108,7 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst * rqstp, | |||
107 | dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); | 108 | dprintk("nfsd: SETACL(2acl) %s\n", SVCFH_fmt(&argp->fh)); |
108 | 109 | ||
109 | fh = fh_copy(&resp->fh, &argp->fh); | 110 | fh = fh_copy(&resp->fh, &argp->fh); |
110 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); | 111 | nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); |
111 | 112 | ||
112 | if (!nfserr) { | 113 | if (!nfserr) { |
113 | nfserr = nfserrno( nfsd_set_posix_acl( | 114 | nfserr = nfserrno( nfsd_set_posix_acl( |
@@ -134,7 +135,7 @@ static __be32 nfsacld_proc_getattr(struct svc_rqst * rqstp, | |||
134 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); | 135 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); |
135 | 136 | ||
136 | fh_copy(&resp->fh, &argp->fh); | 137 | fh_copy(&resp->fh, &argp->fh); |
137 | return fh_verify(rqstp, &resp->fh, 0, MAY_NOP); | 138 | return fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
138 | } | 139 | } |
139 | 140 | ||
140 | /* | 141 | /* |
diff --git a/fs/nfsd/nfs3acl.c b/fs/nfsd/nfs3acl.c index b647f2f872dc..9981dbb377a3 100644 --- a/fs/nfsd/nfs3acl.c +++ b/fs/nfsd/nfs3acl.c | |||
@@ -36,7 +36,8 @@ static __be32 nfsd3_proc_getacl(struct svc_rqst * rqstp, | |||
36 | __be32 nfserr = 0; | 36 | __be32 nfserr = 0; |
37 | 37 | ||
38 | fh = fh_copy(&resp->fh, &argp->fh); | 38 | fh = fh_copy(&resp->fh, &argp->fh); |
39 | if ((nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP))) | 39 | nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
40 | if (nfserr) | ||
40 | RETURN_STATUS(nfserr); | 41 | RETURN_STATUS(nfserr); |
41 | 42 | ||
42 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) | 43 | if (argp->mask & ~(NFS_ACL|NFS_ACLCNT|NFS_DFACL|NFS_DFACLCNT)) |
@@ -101,7 +102,7 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst * rqstp, | |||
101 | __be32 nfserr = 0; | 102 | __be32 nfserr = 0; |
102 | 103 | ||
103 | fh = fh_copy(&resp->fh, &argp->fh); | 104 | fh = fh_copy(&resp->fh, &argp->fh); |
104 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_SATTR); | 105 | nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR); |
105 | 106 | ||
106 | if (!nfserr) { | 107 | if (!nfserr) { |
107 | nfserr = nfserrno( nfsd_set_posix_acl( | 108 | nfserr = nfserrno( nfsd_set_posix_acl( |
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index c721a1e6e9dd..4d617ea28cfc 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c | |||
@@ -63,7 +63,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | |||
63 | SVCFH_fmt(&argp->fh)); | 63 | SVCFH_fmt(&argp->fh)); |
64 | 64 | ||
65 | fh_copy(&resp->fh, &argp->fh); | 65 | fh_copy(&resp->fh, &argp->fh); |
66 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP); | 66 | nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
67 | if (nfserr) | 67 | if (nfserr) |
68 | RETURN_STATUS(nfserr); | 68 | RETURN_STATUS(nfserr); |
69 | 69 | ||
@@ -242,7 +242,7 @@ nfsd3_proc_create(struct svc_rqst *rqstp, struct nfsd3_createargs *argp, | |||
242 | attr = &argp->attrs; | 242 | attr = &argp->attrs; |
243 | 243 | ||
244 | /* Get the directory inode */ | 244 | /* Get the directory inode */ |
245 | nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, MAY_CREATE); | 245 | nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_CREATE); |
246 | if (nfserr) | 246 | if (nfserr) |
247 | RETURN_STATUS(nfserr); | 247 | RETURN_STATUS(nfserr); |
248 | 248 | ||
@@ -558,7 +558,7 @@ nfsd3_proc_fsinfo(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | |||
558 | resp->f_maxfilesize = ~(u32) 0; | 558 | resp->f_maxfilesize = ~(u32) 0; |
559 | resp->f_properties = NFS3_FSF_DEFAULT; | 559 | resp->f_properties = NFS3_FSF_DEFAULT; |
560 | 560 | ||
561 | nfserr = fh_verify(rqstp, &argp->fh, 0, MAY_NOP); | 561 | nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); |
562 | 562 | ||
563 | /* Check special features of the file system. May request | 563 | /* Check special features of the file system. May request |
564 | * different read/write sizes for file systems known to have | 564 | * different read/write sizes for file systems known to have |
@@ -597,7 +597,7 @@ nfsd3_proc_pathconf(struct svc_rqst * rqstp, struct nfsd_fhandle *argp, | |||
597 | resp->p_case_insensitive = 0; | 597 | resp->p_case_insensitive = 0; |
598 | resp->p_case_preserving = 1; | 598 | resp->p_case_preserving = 1; |
599 | 599 | ||
600 | nfserr = fh_verify(rqstp, &argp->fh, 0, MAY_NOP); | 600 | nfserr = fh_verify(rqstp, &argp->fh, 0, NFSD_MAY_NOP); |
601 | 601 | ||
602 | if (nfserr == 0) { | 602 | if (nfserr == 0) { |
603 | struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb; | 603 | struct super_block *sb = argp->fh.fh_dentry->d_inode->i_sb; |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 313484380a9b..5c3683cfd59e 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -71,11 +71,11 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs | |||
71 | return nfserr_inval; | 71 | return nfserr_inval; |
72 | 72 | ||
73 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) | 73 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) |
74 | accmode |= MAY_READ; | 74 | accmode |= NFSD_MAY_READ; |
75 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) | 75 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) |
76 | accmode |= (MAY_WRITE | MAY_TRUNC); | 76 | accmode |= (NFSD_MAY_WRITE | NFSD_MAY_TRUNC); |
77 | if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) | 77 | if (open->op_share_deny & NFS4_SHARE_DENY_WRITE) |
78 | accmode |= MAY_WRITE; | 78 | accmode |= NFSD_MAY_WRITE; |
79 | 79 | ||
80 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); | 80 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); |
81 | 81 | ||
@@ -126,7 +126,8 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
126 | &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size); | 126 | &resfh.fh_handle.fh_base, resfh.fh_handle.fh_size); |
127 | 127 | ||
128 | if (!created) | 128 | if (!created) |
129 | status = do_open_permission(rqstp, current_fh, open, MAY_NOP); | 129 | status = do_open_permission(rqstp, current_fh, open, |
130 | NFSD_MAY_NOP); | ||
130 | 131 | ||
131 | out: | 132 | out: |
132 | fh_put(&resfh); | 133 | fh_put(&resfh); |
@@ -157,7 +158,8 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ | |||
157 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && | 158 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && |
158 | (open->op_iattr.ia_size == 0); | 159 | (open->op_iattr.ia_size == 0); |
159 | 160 | ||
160 | status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE); | 161 | status = do_open_permission(rqstp, current_fh, open, |
162 | NFSD_MAY_OWNER_OVERRIDE); | ||
161 | 163 | ||
162 | return status; | 164 | return status; |
163 | } | 165 | } |
@@ -186,7 +188,7 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
186 | cstate->current_fh.fh_handle.fh_size = rp->rp_openfh_len; | 188 | cstate->current_fh.fh_handle.fh_size = rp->rp_openfh_len; |
187 | memcpy(&cstate->current_fh.fh_handle.fh_base, rp->rp_openfh, | 189 | memcpy(&cstate->current_fh.fh_handle.fh_base, rp->rp_openfh, |
188 | rp->rp_openfh_len); | 190 | rp->rp_openfh_len); |
189 | status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP); | 191 | status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); |
190 | if (status) | 192 | if (status) |
191 | dprintk("nfsd4_open: replay failed" | 193 | dprintk("nfsd4_open: replay failed" |
192 | " restoring previous filehandle\n"); | 194 | " restoring previous filehandle\n"); |
@@ -285,7 +287,7 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
285 | cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen; | 287 | cstate->current_fh.fh_handle.fh_size = putfh->pf_fhlen; |
286 | memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval, | 288 | memcpy(&cstate->current_fh.fh_handle.fh_base, putfh->pf_fhval, |
287 | putfh->pf_fhlen); | 289 | putfh->pf_fhlen); |
288 | return fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP); | 290 | return fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); |
289 | } | 291 | } |
290 | 292 | ||
291 | static __be32 | 293 | static __be32 |
@@ -363,7 +365,8 @@ nfsd4_create(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
363 | 365 | ||
364 | fh_init(&resfh, NFS4_FHSIZE); | 366 | fh_init(&resfh, NFS4_FHSIZE); |
365 | 367 | ||
366 | status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, MAY_CREATE); | 368 | status = fh_verify(rqstp, &cstate->current_fh, S_IFDIR, |
369 | NFSD_MAY_CREATE); | ||
367 | if (status == nfserr_symlink) | 370 | if (status == nfserr_symlink) |
368 | status = nfserr_notdir; | 371 | status = nfserr_notdir; |
369 | if (status) | 372 | if (status) |
@@ -445,7 +448,7 @@ nfsd4_getattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
445 | { | 448 | { |
446 | __be32 status; | 449 | __be32 status; |
447 | 450 | ||
448 | status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP); | 451 | status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); |
449 | if (status) | 452 | if (status) |
450 | return status; | 453 | return status; |
451 | 454 | ||
@@ -730,7 +733,7 @@ _nfsd4_verify(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
730 | int count; | 733 | int count; |
731 | __be32 status; | 734 | __be32 status; |
732 | 735 | ||
733 | status = fh_verify(rqstp, &cstate->current_fh, 0, MAY_NOP); | 736 | status = fh_verify(rqstp, &cstate->current_fh, 0, NFSD_MAY_NOP); |
734 | if (status) | 737 | if (status) |
735 | return status; | 738 | return status; |
736 | 739 | ||
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index bf11d6879ab4..eca8aaa450f1 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1722,9 +1722,9 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf | |||
1722 | /* Stateid was not found, this is a new OPEN */ | 1722 | /* Stateid was not found, this is a new OPEN */ |
1723 | int flags = 0; | 1723 | int flags = 0; |
1724 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) | 1724 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) |
1725 | flags |= MAY_READ; | 1725 | flags |= NFSD_MAY_READ; |
1726 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) | 1726 | if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) |
1727 | flags |= MAY_WRITE; | 1727 | flags |= NFSD_MAY_WRITE; |
1728 | status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags); | 1728 | status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags); |
1729 | if (status) | 1729 | if (status) |
1730 | goto out; | 1730 | goto out; |
@@ -2610,7 +2610,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
2610 | return nfserr_inval; | 2610 | return nfserr_inval; |
2611 | 2611 | ||
2612 | if ((status = fh_verify(rqstp, &cstate->current_fh, | 2612 | if ((status = fh_verify(rqstp, &cstate->current_fh, |
2613 | S_IFREG, MAY_LOCK))) { | 2613 | S_IFREG, NFSD_MAY_LOCK))) { |
2614 | dprintk("NFSD: nfsd4_lock: permission denied!\n"); | 2614 | dprintk("NFSD: nfsd4_lock: permission denied!\n"); |
2615 | return status; | 2615 | return status; |
2616 | } | 2616 | } |
diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index 100ae5641162..c7b0fdaeac96 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c | |||
@@ -279,7 +279,7 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) | |||
279 | if (error) | 279 | if (error) |
280 | goto out; | 280 | goto out; |
281 | 281 | ||
282 | if (!(access & MAY_LOCK)) { | 282 | if (!(access & NFSD_MAY_LOCK)) { |
283 | /* | 283 | /* |
284 | * pseudoflavor restrictions are not enforced on NLM, | 284 | * pseudoflavor restrictions are not enforced on NLM, |
285 | * which clients virtually always use auth_sys for, | 285 | * which clients virtually always use auth_sys for, |
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index b5a20c486712..0766f95d236a 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c | |||
@@ -65,7 +65,7 @@ nfsd_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, | |||
65 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); | 65 | dprintk("nfsd: GETATTR %s\n", SVCFH_fmt(&argp->fh)); |
66 | 66 | ||
67 | fh_copy(&resp->fh, &argp->fh); | 67 | fh_copy(&resp->fh, &argp->fh); |
68 | nfserr = fh_verify(rqstp, &resp->fh, 0, MAY_NOP); | 68 | nfserr = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_NOP); |
69 | return nfsd_return_attrs(nfserr, resp); | 69 | return nfsd_return_attrs(nfserr, resp); |
70 | } | 70 | } |
71 | 71 | ||
@@ -215,11 +215,11 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
215 | SVCFH_fmt(dirfhp), argp->len, argp->name); | 215 | SVCFH_fmt(dirfhp), argp->len, argp->name); |
216 | 216 | ||
217 | /* First verify the parent file handle */ | 217 | /* First verify the parent file handle */ |
218 | nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, MAY_EXEC); | 218 | nfserr = fh_verify(rqstp, dirfhp, S_IFDIR, NFSD_MAY_EXEC); |
219 | if (nfserr) | 219 | if (nfserr) |
220 | goto done; /* must fh_put dirfhp even on error */ | 220 | goto done; /* must fh_put dirfhp even on error */ |
221 | 221 | ||
222 | /* Check for MAY_WRITE in nfsd_create if necessary */ | 222 | /* Check for NFSD_MAY_WRITE in nfsd_create if necessary */ |
223 | 223 | ||
224 | nfserr = nfserr_acces; | 224 | nfserr = nfserr_acces; |
225 | if (!argp->len) | 225 | if (!argp->len) |
@@ -281,7 +281,7 @@ nfsd_proc_create(struct svc_rqst *rqstp, struct nfsd_createargs *argp, | |||
281 | nfserr = nfsd_permission(rqstp, | 281 | nfserr = nfsd_permission(rqstp, |
282 | newfhp->fh_export, | 282 | newfhp->fh_export, |
283 | newfhp->fh_dentry, | 283 | newfhp->fh_dentry, |
284 | MAY_WRITE|MAY_LOCAL_ACCESS); | 284 | NFSD_MAY_WRITE|NFSD_MAY_LOCAL_ACCESS); |
285 | if (nfserr && nfserr != nfserr_rofs) | 285 | if (nfserr && nfserr != nfserr_rofs) |
286 | goto out_unlock; | 286 | goto out_unlock; |
287 | } | 287 | } |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index a3a291f771f4..5e05ddda4560 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -144,7 +144,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
144 | dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name); | 144 | dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name); |
145 | 145 | ||
146 | /* Obtain dentry and export. */ | 146 | /* Obtain dentry and export. */ |
147 | err = fh_verify(rqstp, fhp, S_IFDIR, MAY_EXEC); | 147 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_EXEC); |
148 | if (err) | 148 | if (err) |
149 | return err; | 149 | return err; |
150 | 150 | ||
@@ -262,14 +262,14 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
262 | { | 262 | { |
263 | struct dentry *dentry; | 263 | struct dentry *dentry; |
264 | struct inode *inode; | 264 | struct inode *inode; |
265 | int accmode = MAY_SATTR; | 265 | int accmode = NFSD_MAY_SATTR; |
266 | int ftype = 0; | 266 | int ftype = 0; |
267 | __be32 err; | 267 | __be32 err; |
268 | int host_err; | 268 | int host_err; |
269 | int size_change = 0; | 269 | int size_change = 0; |
270 | 270 | ||
271 | if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) | 271 | if (iap->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_SIZE)) |
272 | accmode |= MAY_WRITE|MAY_OWNER_OVERRIDE; | 272 | accmode |= NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; |
273 | if (iap->ia_valid & ATTR_SIZE) | 273 | if (iap->ia_valid & ATTR_SIZE) |
274 | ftype = S_IFREG; | 274 | ftype = S_IFREG; |
275 | 275 | ||
@@ -331,7 +331,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, | |||
331 | */ | 331 | */ |
332 | if (iap->ia_valid & ATTR_SIZE) { | 332 | if (iap->ia_valid & ATTR_SIZE) { |
333 | if (iap->ia_size < inode->i_size) { | 333 | if (iap->ia_size < inode->i_size) { |
334 | err = nfsd_permission(rqstp, fhp->fh_export, dentry, MAY_TRUNC|MAY_OWNER_OVERRIDE); | 334 | err = nfsd_permission(rqstp, fhp->fh_export, dentry, |
335 | NFSD_MAY_TRUNC|NFSD_MAY_OWNER_OVERRIDE); | ||
335 | if (err) | 336 | if (err) |
336 | goto out; | 337 | goto out; |
337 | } | 338 | } |
@@ -462,7 +463,7 @@ nfsd4_set_nfs4_acl(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
462 | unsigned int flags = 0; | 463 | unsigned int flags = 0; |
463 | 464 | ||
464 | /* Get inode */ | 465 | /* Get inode */ |
465 | error = fh_verify(rqstp, fhp, 0 /* S_IFREG */, MAY_SATTR); | 466 | error = fh_verify(rqstp, fhp, 0 /* S_IFREG */, NFSD_MAY_SATTR); |
466 | if (error) | 467 | if (error) |
467 | return error; | 468 | return error; |
468 | 469 | ||
@@ -563,20 +564,20 @@ struct accessmap { | |||
563 | int how; | 564 | int how; |
564 | }; | 565 | }; |
565 | static struct accessmap nfs3_regaccess[] = { | 566 | static struct accessmap nfs3_regaccess[] = { |
566 | { NFS3_ACCESS_READ, MAY_READ }, | 567 | { NFS3_ACCESS_READ, NFSD_MAY_READ }, |
567 | { NFS3_ACCESS_EXECUTE, MAY_EXEC }, | 568 | { NFS3_ACCESS_EXECUTE, NFSD_MAY_EXEC }, |
568 | { NFS3_ACCESS_MODIFY, MAY_WRITE|MAY_TRUNC }, | 569 | { NFS3_ACCESS_MODIFY, NFSD_MAY_WRITE|NFSD_MAY_TRUNC }, |
569 | { NFS3_ACCESS_EXTEND, MAY_WRITE }, | 570 | { NFS3_ACCESS_EXTEND, NFSD_MAY_WRITE }, |
570 | 571 | ||
571 | { 0, 0 } | 572 | { 0, 0 } |
572 | }; | 573 | }; |
573 | 574 | ||
574 | static struct accessmap nfs3_diraccess[] = { | 575 | static struct accessmap nfs3_diraccess[] = { |
575 | { NFS3_ACCESS_READ, MAY_READ }, | 576 | { NFS3_ACCESS_READ, NFSD_MAY_READ }, |
576 | { NFS3_ACCESS_LOOKUP, MAY_EXEC }, | 577 | { NFS3_ACCESS_LOOKUP, NFSD_MAY_EXEC }, |
577 | { NFS3_ACCESS_MODIFY, MAY_EXEC|MAY_WRITE|MAY_TRUNC }, | 578 | { NFS3_ACCESS_MODIFY, NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC}, |
578 | { NFS3_ACCESS_EXTEND, MAY_EXEC|MAY_WRITE }, | 579 | { NFS3_ACCESS_EXTEND, NFSD_MAY_EXEC|NFSD_MAY_WRITE }, |
579 | { NFS3_ACCESS_DELETE, MAY_REMOVE }, | 580 | { NFS3_ACCESS_DELETE, NFSD_MAY_REMOVE }, |
580 | 581 | ||
581 | { 0, 0 } | 582 | { 0, 0 } |
582 | }; | 583 | }; |
@@ -589,10 +590,10 @@ static struct accessmap nfs3_anyaccess[] = { | |||
589 | * mainly at mode bits, and we make sure to ignore read-only | 590 | * mainly at mode bits, and we make sure to ignore read-only |
590 | * filesystem checks | 591 | * filesystem checks |
591 | */ | 592 | */ |
592 | { NFS3_ACCESS_READ, MAY_READ }, | 593 | { NFS3_ACCESS_READ, NFSD_MAY_READ }, |
593 | { NFS3_ACCESS_EXECUTE, MAY_EXEC }, | 594 | { NFS3_ACCESS_EXECUTE, NFSD_MAY_EXEC }, |
594 | { NFS3_ACCESS_MODIFY, MAY_WRITE|MAY_LOCAL_ACCESS }, | 595 | { NFS3_ACCESS_MODIFY, NFSD_MAY_WRITE|NFSD_MAY_LOCAL_ACCESS }, |
595 | { NFS3_ACCESS_EXTEND, MAY_WRITE|MAY_LOCAL_ACCESS }, | 596 | { NFS3_ACCESS_EXTEND, NFSD_MAY_WRITE|NFSD_MAY_LOCAL_ACCESS }, |
596 | 597 | ||
597 | { 0, 0 } | 598 | { 0, 0 } |
598 | }; | 599 | }; |
@@ -606,7 +607,7 @@ nfsd_access(struct svc_rqst *rqstp, struct svc_fh *fhp, u32 *access, u32 *suppor | |||
606 | u32 query, result = 0, sresult = 0; | 607 | u32 query, result = 0, sresult = 0; |
607 | __be32 error; | 608 | __be32 error; |
608 | 609 | ||
609 | error = fh_verify(rqstp, fhp, 0, MAY_NOP); | 610 | error = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP); |
610 | if (error) | 611 | if (error) |
611 | goto out; | 612 | goto out; |
612 | 613 | ||
@@ -678,7 +679,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
678 | * and (hopefully) checked permission - so allow OWNER_OVERRIDE | 679 | * and (hopefully) checked permission - so allow OWNER_OVERRIDE |
679 | * in case a chmod has now revoked permission. | 680 | * in case a chmod has now revoked permission. |
680 | */ | 681 | */ |
681 | err = fh_verify(rqstp, fhp, type, access | MAY_OWNER_OVERRIDE); | 682 | err = fh_verify(rqstp, fhp, type, access | NFSD_MAY_OWNER_OVERRIDE); |
682 | if (err) | 683 | if (err) |
683 | goto out; | 684 | goto out; |
684 | 685 | ||
@@ -689,7 +690,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
689 | * or any access when mandatory locking enabled | 690 | * or any access when mandatory locking enabled |
690 | */ | 691 | */ |
691 | err = nfserr_perm; | 692 | err = nfserr_perm; |
692 | if (IS_APPEND(inode) && (access & MAY_WRITE)) | 693 | if (IS_APPEND(inode) && (access & NFSD_MAY_WRITE)) |
693 | goto out; | 694 | goto out; |
694 | /* | 695 | /* |
695 | * We must ignore files (but only files) which might have mandatory | 696 | * We must ignore files (but only files) which might have mandatory |
@@ -706,14 +707,14 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
706 | * Check to see if there are any leases on this file. | 707 | * Check to see if there are any leases on this file. |
707 | * This may block while leases are broken. | 708 | * This may block while leases are broken. |
708 | */ | 709 | */ |
709 | host_err = break_lease(inode, O_NONBLOCK | ((access & MAY_WRITE) ? FMODE_WRITE : 0)); | 710 | host_err = break_lease(inode, O_NONBLOCK | ((access & NFSD_MAY_WRITE) ? FMODE_WRITE : 0)); |
710 | if (host_err == -EWOULDBLOCK) | 711 | if (host_err == -EWOULDBLOCK) |
711 | host_err = -ETIMEDOUT; | 712 | host_err = -ETIMEDOUT; |
712 | if (host_err) /* NOMEM or WOULDBLOCK */ | 713 | if (host_err) /* NOMEM or WOULDBLOCK */ |
713 | goto out_nfserr; | 714 | goto out_nfserr; |
714 | 715 | ||
715 | if (access & MAY_WRITE) { | 716 | if (access & NFSD_MAY_WRITE) { |
716 | if (access & MAY_READ) | 717 | if (access & NFSD_MAY_READ) |
717 | flags = O_RDWR|O_LARGEFILE; | 718 | flags = O_RDWR|O_LARGEFILE; |
718 | else | 719 | else |
719 | flags = O_WRONLY|O_LARGEFILE; | 720 | flags = O_WRONLY|O_LARGEFILE; |
@@ -1069,12 +1070,12 @@ nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1069 | 1070 | ||
1070 | if (file) { | 1071 | if (file) { |
1071 | err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, | 1072 | err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, |
1072 | MAY_READ|MAY_OWNER_OVERRIDE); | 1073 | NFSD_MAY_READ|NFSD_MAY_OWNER_OVERRIDE); |
1073 | if (err) | 1074 | if (err) |
1074 | goto out; | 1075 | goto out; |
1075 | err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count); | 1076 | err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count); |
1076 | } else { | 1077 | } else { |
1077 | err = nfsd_open(rqstp, fhp, S_IFREG, MAY_READ, &file); | 1078 | err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); |
1078 | if (err) | 1079 | if (err) |
1079 | goto out; | 1080 | goto out; |
1080 | err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count); | 1081 | err = nfsd_vfs_read(rqstp, fhp, file, offset, vec, vlen, count); |
@@ -1098,13 +1099,13 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1098 | 1099 | ||
1099 | if (file) { | 1100 | if (file) { |
1100 | err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, | 1101 | err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry, |
1101 | MAY_WRITE|MAY_OWNER_OVERRIDE); | 1102 | NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE); |
1102 | if (err) | 1103 | if (err) |
1103 | goto out; | 1104 | goto out; |
1104 | err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt, | 1105 | err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt, |
1105 | stablep); | 1106 | stablep); |
1106 | } else { | 1107 | } else { |
1107 | err = nfsd_open(rqstp, fhp, S_IFREG, MAY_WRITE, &file); | 1108 | err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_WRITE, &file); |
1108 | if (err) | 1109 | if (err) |
1109 | goto out; | 1110 | goto out; |
1110 | 1111 | ||
@@ -1136,7 +1137,8 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1136 | if ((u64)count > ~(u64)offset) | 1137 | if ((u64)count > ~(u64)offset) |
1137 | return nfserr_inval; | 1138 | return nfserr_inval; |
1138 | 1139 | ||
1139 | if ((err = nfsd_open(rqstp, fhp, S_IFREG, MAY_WRITE, &file)) != 0) | 1140 | err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_WRITE, &file); |
1141 | if (err) | ||
1140 | return err; | 1142 | return err; |
1141 | if (EX_ISSYNC(fhp->fh_export)) { | 1143 | if (EX_ISSYNC(fhp->fh_export)) { |
1142 | if (file->f_op && file->f_op->fsync) { | 1144 | if (file->f_op && file->f_op->fsync) { |
@@ -1197,7 +1199,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1197 | if (isdotent(fname, flen)) | 1199 | if (isdotent(fname, flen)) |
1198 | goto out; | 1200 | goto out; |
1199 | 1201 | ||
1200 | err = fh_verify(rqstp, fhp, S_IFDIR, MAY_CREATE); | 1202 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); |
1201 | if (err) | 1203 | if (err) |
1202 | goto out; | 1204 | goto out; |
1203 | 1205 | ||
@@ -1334,7 +1336,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1334 | goto out; | 1336 | goto out; |
1335 | if (!(iap->ia_valid & ATTR_MODE)) | 1337 | if (!(iap->ia_valid & ATTR_MODE)) |
1336 | iap->ia_mode = 0; | 1338 | iap->ia_mode = 0; |
1337 | err = fh_verify(rqstp, fhp, S_IFDIR, MAY_CREATE); | 1339 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); |
1338 | if (err) | 1340 | if (err) |
1339 | goto out; | 1341 | goto out; |
1340 | 1342 | ||
@@ -1471,7 +1473,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) | |||
1471 | __be32 err; | 1473 | __be32 err; |
1472 | int host_err; | 1474 | int host_err; |
1473 | 1475 | ||
1474 | err = fh_verify(rqstp, fhp, S_IFLNK, MAY_NOP); | 1476 | err = fh_verify(rqstp, fhp, S_IFLNK, NFSD_MAY_NOP); |
1475 | if (err) | 1477 | if (err) |
1476 | goto out; | 1478 | goto out; |
1477 | 1479 | ||
@@ -1526,7 +1528,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, | |||
1526 | if (isdotent(fname, flen)) | 1528 | if (isdotent(fname, flen)) |
1527 | goto out; | 1529 | goto out; |
1528 | 1530 | ||
1529 | err = fh_verify(rqstp, fhp, S_IFDIR, MAY_CREATE); | 1531 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_CREATE); |
1530 | if (err) | 1532 | if (err) |
1531 | goto out; | 1533 | goto out; |
1532 | fh_lock(fhp); | 1534 | fh_lock(fhp); |
@@ -1591,10 +1593,10 @@ nfsd_link(struct svc_rqst *rqstp, struct svc_fh *ffhp, | |||
1591 | __be32 err; | 1593 | __be32 err; |
1592 | int host_err; | 1594 | int host_err; |
1593 | 1595 | ||
1594 | err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_CREATE); | 1596 | err = fh_verify(rqstp, ffhp, S_IFDIR, NFSD_MAY_CREATE); |
1595 | if (err) | 1597 | if (err) |
1596 | goto out; | 1598 | goto out; |
1597 | err = fh_verify(rqstp, tfhp, -S_IFDIR, MAY_NOP); | 1599 | err = fh_verify(rqstp, tfhp, -S_IFDIR, NFSD_MAY_NOP); |
1598 | if (err) | 1600 | if (err) |
1599 | goto out; | 1601 | goto out; |
1600 | 1602 | ||
@@ -1661,10 +1663,10 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen, | |||
1661 | __be32 err; | 1663 | __be32 err; |
1662 | int host_err; | 1664 | int host_err; |
1663 | 1665 | ||
1664 | err = fh_verify(rqstp, ffhp, S_IFDIR, MAY_REMOVE); | 1666 | err = fh_verify(rqstp, ffhp, S_IFDIR, NFSD_MAY_REMOVE); |
1665 | if (err) | 1667 | if (err) |
1666 | goto out; | 1668 | goto out; |
1667 | err = fh_verify(rqstp, tfhp, S_IFDIR, MAY_CREATE); | 1669 | err = fh_verify(rqstp, tfhp, S_IFDIR, NFSD_MAY_CREATE); |
1668 | if (err) | 1670 | if (err) |
1669 | goto out; | 1671 | goto out; |
1670 | 1672 | ||
@@ -1768,7 +1770,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, | |||
1768 | err = nfserr_acces; | 1770 | err = nfserr_acces; |
1769 | if (!flen || isdotent(fname, flen)) | 1771 | if (!flen || isdotent(fname, flen)) |
1770 | goto out; | 1772 | goto out; |
1771 | err = fh_verify(rqstp, fhp, S_IFDIR, MAY_REMOVE); | 1773 | err = fh_verify(rqstp, fhp, S_IFDIR, NFSD_MAY_REMOVE); |
1772 | if (err) | 1774 | if (err) |
1773 | goto out; | 1775 | goto out; |
1774 | 1776 | ||
@@ -1834,7 +1836,7 @@ nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, | |||
1834 | struct file *file; | 1836 | struct file *file; |
1835 | loff_t offset = *offsetp; | 1837 | loff_t offset = *offsetp; |
1836 | 1838 | ||
1837 | err = nfsd_open(rqstp, fhp, S_IFDIR, MAY_READ, &file); | 1839 | err = nfsd_open(rqstp, fhp, S_IFDIR, NFSD_MAY_READ, &file); |
1838 | if (err) | 1840 | if (err) |
1839 | goto out; | 1841 | goto out; |
1840 | 1842 | ||
@@ -1875,7 +1877,7 @@ out: | |||
1875 | __be32 | 1877 | __be32 |
1876 | nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) | 1878 | nfsd_statfs(struct svc_rqst *rqstp, struct svc_fh *fhp, struct kstatfs *stat) |
1877 | { | 1879 | { |
1878 | __be32 err = fh_verify(rqstp, fhp, 0, MAY_NOP); | 1880 | __be32 err = fh_verify(rqstp, fhp, 0, NFSD_MAY_NOP); |
1879 | if (!err && vfs_statfs(fhp->fh_dentry,stat)) | 1881 | if (!err && vfs_statfs(fhp->fh_dentry,stat)) |
1880 | err = nfserr_io; | 1882 | err = nfserr_io; |
1881 | return err; | 1883 | return err; |
@@ -1896,18 +1898,18 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | |||
1896 | struct inode *inode = dentry->d_inode; | 1898 | struct inode *inode = dentry->d_inode; |
1897 | int err; | 1899 | int err; |
1898 | 1900 | ||
1899 | if (acc == MAY_NOP) | 1901 | if (acc == NFSD_MAY_NOP) |
1900 | return 0; | 1902 | return 0; |
1901 | #if 0 | 1903 | #if 0 |
1902 | dprintk("nfsd: permission 0x%x%s%s%s%s%s%s%s mode 0%o%s%s%s\n", | 1904 | dprintk("nfsd: permission 0x%x%s%s%s%s%s%s%s mode 0%o%s%s%s\n", |
1903 | acc, | 1905 | acc, |
1904 | (acc & MAY_READ)? " read" : "", | 1906 | (acc & NFSD_MAY_READ)? " read" : "", |
1905 | (acc & MAY_WRITE)? " write" : "", | 1907 | (acc & NFSD_MAY_WRITE)? " write" : "", |
1906 | (acc & MAY_EXEC)? " exec" : "", | 1908 | (acc & NFSD_MAY_EXEC)? " exec" : "", |
1907 | (acc & MAY_SATTR)? " sattr" : "", | 1909 | (acc & NFSD_MAY_SATTR)? " sattr" : "", |
1908 | (acc & MAY_TRUNC)? " trunc" : "", | 1910 | (acc & NFSD_MAY_TRUNC)? " trunc" : "", |
1909 | (acc & MAY_LOCK)? " lock" : "", | 1911 | (acc & NFSD_MAY_LOCK)? " lock" : "", |
1910 | (acc & MAY_OWNER_OVERRIDE)? " owneroverride" : "", | 1912 | (acc & NFSD_MAY_OWNER_OVERRIDE)? " owneroverride" : "", |
1911 | inode->i_mode, | 1913 | inode->i_mode, |
1912 | IS_IMMUTABLE(inode)? " immut" : "", | 1914 | IS_IMMUTABLE(inode)? " immut" : "", |
1913 | IS_APPEND(inode)? " append" : "", | 1915 | IS_APPEND(inode)? " append" : "", |
@@ -1920,18 +1922,18 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | |||
1920 | * system. But if it is IRIX doing check on write-access for a | 1922 | * system. But if it is IRIX doing check on write-access for a |
1921 | * device special file, we ignore rofs. | 1923 | * device special file, we ignore rofs. |
1922 | */ | 1924 | */ |
1923 | if (!(acc & MAY_LOCAL_ACCESS)) | 1925 | if (!(acc & NFSD_MAY_LOCAL_ACCESS)) |
1924 | if (acc & (MAY_WRITE | MAY_SATTR | MAY_TRUNC)) { | 1926 | if (acc & (NFSD_MAY_WRITE | NFSD_MAY_SATTR | NFSD_MAY_TRUNC)) { |
1925 | if (exp_rdonly(rqstp, exp) || | 1927 | if (exp_rdonly(rqstp, exp) || |
1926 | __mnt_is_readonly(exp->ex_path.mnt)) | 1928 | __mnt_is_readonly(exp->ex_path.mnt)) |
1927 | return nfserr_rofs; | 1929 | return nfserr_rofs; |
1928 | if (/* (acc & MAY_WRITE) && */ IS_IMMUTABLE(inode)) | 1930 | if (/* (acc & NFSD_MAY_WRITE) && */ IS_IMMUTABLE(inode)) |
1929 | return nfserr_perm; | 1931 | return nfserr_perm; |
1930 | } | 1932 | } |
1931 | if ((acc & MAY_TRUNC) && IS_APPEND(inode)) | 1933 | if ((acc & NFSD_MAY_TRUNC) && IS_APPEND(inode)) |
1932 | return nfserr_perm; | 1934 | return nfserr_perm; |
1933 | 1935 | ||
1934 | if (acc & MAY_LOCK) { | 1936 | if (acc & NFSD_MAY_LOCK) { |
1935 | /* If we cannot rely on authentication in NLM requests, | 1937 | /* If we cannot rely on authentication in NLM requests, |
1936 | * just allow locks, otherwise require read permission, or | 1938 | * just allow locks, otherwise require read permission, or |
1937 | * ownership | 1939 | * ownership |
@@ -1939,7 +1941,7 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | |||
1939 | if (exp->ex_flags & NFSEXP_NOAUTHNLM) | 1941 | if (exp->ex_flags & NFSEXP_NOAUTHNLM) |
1940 | return 0; | 1942 | return 0; |
1941 | else | 1943 | else |
1942 | acc = MAY_READ | MAY_OWNER_OVERRIDE; | 1944 | acc = NFSD_MAY_READ | NFSD_MAY_OWNER_OVERRIDE; |
1943 | } | 1945 | } |
1944 | /* | 1946 | /* |
1945 | * The file owner always gets access permission for accesses that | 1947 | * The file owner always gets access permission for accesses that |
@@ -1955,15 +1957,16 @@ nfsd_permission(struct svc_rqst *rqstp, struct svc_export *exp, | |||
1955 | * We must trust the client to do permission checking - using "ACCESS" | 1957 | * We must trust the client to do permission checking - using "ACCESS" |
1956 | * with NFSv3. | 1958 | * with NFSv3. |
1957 | */ | 1959 | */ |
1958 | if ((acc & MAY_OWNER_OVERRIDE) && | 1960 | if ((acc & NFSD_MAY_OWNER_OVERRIDE) && |
1959 | inode->i_uid == current->fsuid) | 1961 | inode->i_uid == current->fsuid) |
1960 | return 0; | 1962 | return 0; |
1961 | 1963 | ||
1964 | /* This assumes NFSD_MAY_{READ,WRITE,EXEC} == MAY_{READ,WRITE,EXEC} */ | ||
1962 | err = permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC), NULL); | 1965 | err = permission(inode, acc & (MAY_READ|MAY_WRITE|MAY_EXEC), NULL); |
1963 | 1966 | ||
1964 | /* Allow read access to binaries even when mode 111 */ | 1967 | /* Allow read access to binaries even when mode 111 */ |
1965 | if (err == -EACCES && S_ISREG(inode->i_mode) && | 1968 | if (err == -EACCES && S_ISREG(inode->i_mode) && |
1966 | acc == (MAY_READ | MAY_OWNER_OVERRIDE)) | 1969 | acc == (NFSD_MAY_READ | NFSD_MAY_OWNER_OVERRIDE)) |
1967 | err = permission(inode, MAY_EXEC, NULL); | 1970 | err = permission(inode, MAY_EXEC, NULL); |
1968 | 1971 | ||
1969 | return err? nfserrno(err) : 0; | 1972 | return err? nfserrno(err) : 0; |