diff options
author | 2006-01-18 17:43:38 -0800 | |
---|---|---|
committer | 2006-01-18 19:20:27 -0800 | |
commit | 6c26d08f02f829a833d393c3f1b196538a9ec2c4 (patch) | |
tree | 6425e263f072a73db7ced341c4df9507ae46ccef /fs/nfsd | |
parent | [PATCH] nfsd4: don't create on open that fails due to ERR_GRACE (diff) | |
download | linux-6c26d08f02f829a833d393c3f1b196538a9ec2c4.tar.gz linux-6c26d08f02f829a833d393c3f1b196538a9ec2c4.tar.bz2 linux-6c26d08f02f829a833d393c3f1b196538a9ec2c4.zip |
[PATCH] nfsd4: fix open_downgrade
Bad bookkeeping of the share reservations when handling open upgrades was
causing open downgrade to fail.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 7167dcf8e1fe..82c36ccd8b5c 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1609,26 +1609,26 @@ 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_dentry->d_inode; - unsigned int share_access; + unsigned int share_access, new_writer; int status; set_access(&share_access, stp->st_access_bmap); - share_access = ~share_access; - share_access &= open->op_share_access; - - if (!(share_access & NFS4_SHARE_ACCESS_WRITE)) - return nfsd4_truncate(rqstp, cur_fh, open); + new_writer = (~share_access) & open->op_share_access + & NFS4_SHARE_ACCESS_WRITE; - status = get_write_access(inode); - if (status) - return nfserrno(status); + if (new_writer) { + status = get_write_access(inode); + if (status) + return nfserrno(status); + } status = nfsd4_truncate(rqstp, cur_fh, open); if (status) { - put_write_access(inode); + if (new_writer) + put_write_access(inode); return status; } /* remember the open */ - filp->f_mode = (filp->f_mode | FMODE_WRITE) & ~FMODE_READ; + filp->f_mode |= open->op_share_access; set_bit(open->op_share_access, &stp->st_access_bmap); set_bit(open->op_share_deny, &stp->st_deny_bmap); |