Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 206424
b: refs/heads/master
c: 24a0111
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields committed May 31, 2010
1 parent fdae4a7 commit cde7d06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 172c85dd5764d2766bfd68621e5b54e85c4a6cfa
refs/heads/master: 24a0111e405abeb74701ce3b7b665365c27de19e
16 changes: 12 additions & 4 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2255,6 +2255,13 @@ find_delegation_file(struct nfs4_file *fp, stateid_t *stid)
return NULL;
}

int share_access_to_flags(u32 share_access)
{
share_access &= ~NFS4_SHARE_WANT_MASK;

return share_access == NFS4_SHARE_ACCESS_READ ? RD_STATE : WR_STATE;
}

static __be32
nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
struct nfs4_delegation **dp)
Expand All @@ -2265,8 +2272,7 @@ nfs4_check_deleg(struct nfs4_file *fp, struct nfsd4_open *open,
*dp = find_delegation_file(fp, &open->op_delegate_stateid);
if (*dp == NULL)
goto out;
flags = open->op_share_access == NFS4_SHARE_ACCESS_READ ?
RD_STATE : WR_STATE;
flags = share_access_to_flags(open->op_share_access);
status = nfs4_check_delegmode(*dp, flags);
if (status)
*dp = NULL;
Expand Down Expand Up @@ -2358,6 +2364,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_sta
struct file *filp = stp->st_vfs_file;
struct inode *inode = filp->f_path.dentry->d_inode;
unsigned int share_access, new_writer;
u32 op_share_access;
__be32 status;

set_access(&share_access, stp->st_access_bmap);
Expand All @@ -2380,8 +2387,9 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_sta
return status;
}
/* remember the open */
filp->f_mode |= open->op_share_access;
__set_bit(open->op_share_access, &stp->st_access_bmap);
op_share_access = open->op_share_access & ~NFS4_SHARE_WANT_MASK;
filp->f_mode |= op_share_access;
__set_bit(op_share_access, &stp->st_access_bmap);
__set_bit(open->op_share_deny, &stp->st_deny_bmap);

return nfs_ok;
Expand Down

0 comments on commit cde7d06

Please sign in to comment.