summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2005-11-04 15:33:38 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-11-04 15:33:38 -0500
commitd530838bfa507d67b40d13b00d9cbd7a46a47e78 (patch)
treef4b2be26c0a7b9ed3233a2be016b7e97427f8705 /fs/nfs/nfs4state.c
parent4cecb76ff86db46d2823550256c828b6597f418e (diff)
downloadlinux-d530838bfa507d67b40d13b00d9cbd7a46a47e78.tar.gz
linux-d530838bfa507d67b40d13b00d9cbd7a46a47e78.tar.bz2
linux-d530838bfa507d67b40d13b00d9cbd7a46a47e78.zip
NFSv4: Fix problem with OPEN_DOWNGRADE
RFC 3530 states that for OPEN_DOWNGRADE "The share_access and share_deny bits specified must be exactly equal to the union of the share_access and share_deny bits specified for some subset of the OPENs in effect for current openowner on the current file. Setattr is currently violating the NFSv4 rules for OPEN_DOWNGRADE in that it may cause a downgrade from OPEN4_SHARE_ACCESS_BOTH to OPEN4_SHARE_ACCESS_WRITE despite the fact that there exists no open file with O_WRONLY access mode. Fix the problem by replacing nfs4_find_state() with a modified version of nfs_find_open_context(). Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 959374d833a7..81d964bfd8a7 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -384,28 +384,6 @@ nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode)
}
static struct nfs4_state *
-__nfs4_find_state(struct inode *inode, struct rpc_cred *cred, mode_t mode)
-{
- struct nfs_inode *nfsi = NFS_I(inode);
- struct nfs4_state *state;
-
- mode &= (FMODE_READ|FMODE_WRITE);
- list_for_each_entry(state, &nfsi->open_states, inode_states) {
- if (state->owner->so_cred != cred)
- continue;
- if ((state->state & mode) != mode)
- continue;
- atomic_inc(&state->count);
- if (mode & FMODE_READ)
- state->nreaders++;
- if (mode & FMODE_WRITE)
- state->nwriters++;
- return state;
- }
- return NULL;
-}
-
-static struct nfs4_state *
__nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner)
{
struct nfs_inode *nfsi = NFS_I(inode);
@@ -423,17 +401,6 @@ __nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner)
return NULL;
}
-struct nfs4_state *
-nfs4_find_state(struct inode *inode, struct rpc_cred *cred, mode_t mode)
-{
- struct nfs4_state *state;
-
- spin_lock(&inode->i_lock);
- state = __nfs4_find_state(inode, cred, mode);
- spin_unlock(&inode->i_lock);
- return state;
-}
-
static void
nfs4_free_open_state(struct nfs4_state *state)
{