diff options
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r-- | fs/nfsd/nfs4proc.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 8333db12caca..a05d3376cc46 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -68,20 +68,18 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src) | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static int | 70 | static int |
71 | do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open) | 71 | do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open, int accmode) |
72 | { | 72 | { |
73 | int accmode, status; | 73 | int status; |
74 | 74 | ||
75 | if (open->op_truncate && | 75 | if (open->op_truncate && |
76 | !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) | 76 | !(open->op_share_access & NFS4_SHARE_ACCESS_WRITE)) |
77 | return nfserr_inval; | 77 | return nfserr_inval; |
78 | 78 | ||
79 | accmode = MAY_NOP; | ||
80 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) | 79 | if (open->op_share_access & NFS4_SHARE_ACCESS_READ) |
81 | accmode = MAY_READ; | 80 | accmode |= MAY_READ; |
82 | if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) | 81 | if (open->op_share_deny & NFS4_SHARE_ACCESS_WRITE) |
83 | accmode |= (MAY_WRITE | MAY_TRUNC); | 82 | accmode |= (MAY_WRITE | MAY_TRUNC); |
84 | accmode |= MAY_OWNER_OVERRIDE; | ||
85 | 83 | ||
86 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); | 84 | status = fh_verify(rqstp, current_fh, S_IFREG, accmode); |
87 | 85 | ||
@@ -124,7 +122,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o | |||
124 | &resfh.fh_handle.fh_base, | 122 | &resfh.fh_handle.fh_base, |
125 | resfh.fh_handle.fh_size); | 123 | resfh.fh_handle.fh_size); |
126 | 124 | ||
127 | status = do_open_permission(rqstp, current_fh, open); | 125 | status = do_open_permission(rqstp, current_fh, open, MAY_NOP); |
128 | } | 126 | } |
129 | 127 | ||
130 | fh_put(&resfh); | 128 | fh_put(&resfh); |
@@ -155,7 +153,7 @@ do_open_fhandle(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ | |||
155 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && | 153 | open->op_truncate = (open->op_iattr.ia_valid & ATTR_SIZE) && |
156 | (open->op_iattr.ia_size == 0); | 154 | (open->op_iattr.ia_size == 0); |
157 | 155 | ||
158 | status = do_open_permission(rqstp, current_fh, open); | 156 | status = do_open_permission(rqstp, current_fh, open, MAY_OWNER_OVERRIDE); |
159 | 157 | ||
160 | return status; | 158 | return status; |
161 | } | 159 | } |