diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-10-02 17:11:16 +0200 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-10-02 21:43:07 +0200 |
commit | 4a0954ef347de7409ddf8f8153d893827d3feba8 (patch) | |
tree | 2af06095b536fdd8cf0bff7e549a8d34fb87c651 /fs/nfs/nfs4state.c | |
parent | NFS: Fix a write performance regression (diff) | |
download | linux-4a0954ef347de7409ddf8f8153d893827d3feba8.tar.xz linux-4a0954ef347de7409ddf8f8153d893827d3feba8.zip |
NFSv4: Don't try to reclaim unused state owners
Currently, we don't test if the state owner is in use before we try to
recover it. The problem is that if the refcount is zero, then the
state owner will be waiting on the lru list for garbage collection.
The expectation in that case is that if you bump the refcount, then
you must also remove the state owner from the lru list. Otherwise
the call to nfs4_put_state_owner will corrupt that list by trying
to add our state owner a second time.
Avoid the whole problem by just skipping state owners that hold no
state.
Reported-by: Andrew W Elble <aweits@rit.edu>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to '')
-rw-r--r-- | fs/nfs/nfs4state.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 5db324635e92..d854693a15b0 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1725,7 +1725,8 @@ restart: if (!test_and_clear_bit(ops->owner_flag_bit, &sp->so_flags)) continue; - atomic_inc(&sp->so_count); + if (!atomic_inc_not_zero(&sp->so_count)) + continue; spin_unlock(&clp->cl_lock); rcu_read_unlock(); |