aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2010-05-18 20:01:35 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2010-05-31 12:43:55 -0400
commit24a0111e405abeb74701ce3b7b665365c27de19e (patch)
tree97812d2abd30aeebf9eb1d4977b34a0175665e23 /fs/nfsd
parent172c85dd5764d2766bfd68621e5b54e85c4a6cfa (diff)
nfsd4: fix use of op_share_access
NFSv4.1 adds additional flags to the share_access argument of the open call. These flags need to be masked out in some of the existing code, but current code does that inconsistently. Tested-by: Michael Groshans <groshans@citi.umich.edu> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 12f7109720c2..117670864af0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2255,6 +2255,13 @@ find_delegation_file(struct nfs4_file *fp, stateid_t *stid)
2255 return NULL; 2255 return NULL;
2256} 2256}
2257 2257
2258int share_access_to_flags(u32 share_access)
2259{
2260 share_access &= ~NFS4_SHARE_WANT_MASK;
2261
2262 return share_access == NFS4_SHARE_ACCESS_READ ? RD_STATE : WR_STATE;
2263}
2264
2258static __be32 2265static __be32
2259nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open, 2266nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
2260 struct nfs4_delegation **dp) 2267 struct nfs4_delegation **dp)
@@ -2265,8 +2272,7 @@ nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
2265 *dp = find_delegation_file(fp, &open->op_delegate_stateid); 2272 *dp = find_delegation_file(fp, &open->op_delegate_stateid);
2266 if (*dp == NULL) 2273 if (*dp == NULL)
2267 goto out; 2274 goto out;
2268 flags = open->op_share_access == NFS4_SHARE_ACCESS_READ ? 2275 flags = share_access_to_flags(open->op_share_access);
2269 RD_STATE : WR_STATE;
2270 status = nfs4_check_delegmode(*dp, flags); 2276 status = nfs4_check_delegmode(*dp, flags);
2271 if (status) 2277 if (status)
2272 *dp = NULL; 2278 *dp = NULL;
@@ -2358,6 +2364,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_sta
2358 struct file *filp = stp->st_vfs_file; 2364 struct file *filp = stp->st_vfs_file;
2359 struct inode *inode = filp->f_path.dentry->d_inode; 2365 struct inode *inode = filp->f_path.dentry->d_inode;
2360 unsigned int share_access, new_writer; 2366 unsigned int share_access, new_writer;
2367 u32 op_share_access;
2361 __be32 status; 2368 __be32 status;
2362 2369
2363 set_access(&share_access, stp->st_access_bmap); 2370 set_access(&share_access, stp->st_access_bmap);
@@ -2380,8 +2387,9 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_sta
2380 return status; 2387 return status;
2381 } 2388 }
2382 /* remember the open */ 2389 /* remember the open */
2383 filp->f_mode |= open->op_share_access; 2390 op_share_access = open->op_share_access & ~NFS4_SHARE_WANT_MASK;
2384 __set_bit(open->op_share_access, &stp->st_access_bmap); 2391 filp->f_mode |= op_share_access;
2392 __set_bit(op_share_access, &stp->st_access_bmap);
2385 __set_bit(open->op_share_deny, &stp->st_deny_bmap); 2393 __set_bit(open->op_share_deny, &stp->st_deny_bmap);
2386 2394
2387 return nfs_ok; 2395 return nfs_ok;