Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 259051
b: refs/heads/master
c: f197c27
h: refs/heads/master
i:
  259049: f0c8d9d
  259047: 8f11903
v: v3
  • Loading branch information
J. Bruce Fields committed Jul 15, 2011
1 parent fc63aa9 commit 7d7e423
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 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: 499f3edc23ca0431f3a0a6736b3a40944c81bf3b
refs/heads/master: f197c27196a5e7631b89e2e92daa096fcf7c302c
31 changes: 8 additions & 23 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2336,15 +2336,6 @@ nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
return ret;
}

static inline void
nfs4_file_downgrade(struct nfs4_file *fp, unsigned int share_access)
{
if (share_access & NFS4_SHARE_ACCESS_WRITE)
nfs4_file_put_access(fp, O_WRONLY);
if (share_access & NFS4_SHARE_ACCESS_READ)
nfs4_file_put_access(fp, O_RDONLY);
}

static void nfsd_break_one_deleg(struct nfs4_delegation *dp)
{
/* We're assuming the state code never drops its reference
Expand Down Expand Up @@ -2625,7 +2616,7 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c
status = nfsd4_truncate(rqstp, cur_fh, open);
if (status) {
if (new_access) {
int oflag = nfs4_access_to_omode(new_access);
int oflag = nfs4_access_to_omode(op_share_access);
nfs4_file_put_access(fp, oflag);
}
return status;
Expand Down Expand Up @@ -3489,18 +3480,15 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return status;
}


/*
* unset all bits in union bitmap (bmap) that
* do not exist in share (from successful OPEN_DOWNGRADE)
*/
static void
reset_union_bmap_access(unsigned long access, unsigned long *bmap)
static inline void nfs4_file_downgrade(struct nfs4_stateid *stp, unsigned int to_access)
{
int i;

for (i = 1; i < 4; i++) {
if ((i & access) != i)
__clear_bit(i, bmap);
if (test_bit(i, &stp->st_access_bmap) && !(i & to_access)) {
nfs4_file_put_access(stp->st_file, i);
__clear_bit(i, &stp->st_access_bmap);
}
}
}

Expand All @@ -3521,7 +3509,6 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
{
__be32 status;
struct nfs4_stateid *stp;
unsigned int share_access;

dprintk("NFSD: nfsd4_open_downgrade on file %.*s\n",
(int)cstate->current_fh.fh_dentry->d_name.len,
Expand Down Expand Up @@ -3550,10 +3537,8 @@ nfsd4_open_downgrade(struct svc_rqst *rqstp,
stp->st_deny_bmap, od->od_share_deny);
goto out;
}
set_access(&share_access, stp->st_access_bmap);
nfs4_file_downgrade(stp->st_file, share_access & ~od->od_share_access);
nfs4_file_downgrade(stp, od->od_share_access);

reset_union_bmap_access(od->od_share_access, &stp->st_access_bmap);
reset_union_bmap_deny(od->od_share_deny, &stp->st_deny_bmap);

update_stateid(&stp->st_stateid);
Expand Down

0 comments on commit 7d7e423

Please sign in to comment.