diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-03 14:41:19 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:40 -0400 |
commit | 1c816efa245111c52858fbe55d99474f3c149dd3 (patch) | |
tree | df2d6fdd574a3a5352b5c246366cdeb0e8dcc43a /fs/nfs/nfs4state.c | |
parent | 1b45c46cf75d9c48eb611d5cc41607ac1f046606 (diff) |
NFSv4: Fix a bug in __nfs4_find_state_byowner
The test for state->state == 0 does not tell you that the stateid is in the
process of being freed. It really tells you that the stateid is not yet
initialised...
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r-- | fs/nfs/nfs4state.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index ab0b5ab60e60..ac816b303f3a 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -333,13 +333,10 @@ __nfs4_find_state_byowner(struct inode *inode, struct nfs4_state_owner *owner) | |||
333 | struct nfs4_state *state; | 333 | struct nfs4_state *state; |
334 | 334 | ||
335 | list_for_each_entry(state, &nfsi->open_states, inode_states) { | 335 | list_for_each_entry(state, &nfsi->open_states, inode_states) { |
336 | /* Is this in the process of being freed? */ | 336 | if (state->owner != owner) |
337 | if (state->state == 0) | ||
338 | continue; | 337 | continue; |
339 | if (state->owner == owner) { | 338 | if (atomic_inc_not_zero(&state->count)) |
340 | atomic_inc(&state->count); | ||
341 | return state; | 339 | return state; |
342 | } | ||
343 | } | 340 | } |
344 | return NULL; | 341 | return NULL; |
345 | } | 342 | } |