Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267172
b: refs/heads/master
c: 3d02fa2
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields committed Sep 20, 2011
1 parent d841504 commit 55491f7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 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: f7a4d872078a5e143d88adb561627f637046b05a
refs/heads/master: 3d02fa29dec920c597dd7b7db608a4bc71f088ce
14 changes: 11 additions & 3 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,15 @@ static void nfs4_file_put_fd(struct nfs4_file *fp, int oflag)
static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag)
{
if (atomic_dec_and_test(&fp->fi_access[oflag])) {
nfs4_file_put_fd(fp, O_RDWR);
nfs4_file_put_fd(fp, oflag);
/*
* It's also safe to get rid of the RDWR open *if*
* we no longer have need of the other kind of access
* or if we already have the other kind of open:
*/
if (fp->fi_fds[1-oflag]
|| atomic_read(&fp->fi_access[1 - oflag]) == 0)
nfs4_file_put_fd(fp, O_RDWR);
}
}

Expand Down Expand Up @@ -3500,8 +3507,9 @@ static inline void nfs4_file_downgrade(struct nfs4_ol_stateid *stp, unsigned int
int i;

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

0 comments on commit 55491f7

Please sign in to comment.