1 From e8d975e73e5fa05f983fbf2723120edcf68e0b38 Mon Sep 17 00:00:00 2001
2 From: Olga Kornievskaia <kolga@netapp.com>
3 Date: Fri, 15 May 2015 11:45:31 -0400
4 Subject: fixing infinite OPEN loop in 4.0 stateid recovery
6 From: Olga Kornievskaia <kolga@netapp.com>
8 commit e8d975e73e5fa05f983fbf2723120edcf68e0b38 upstream.
10 Problem: When an operation like WRITE receives a BAD_STATEID, even though
11 recovery code clears the RECLAIM_NOGRACE recovery flag before recovering
12 the open state, because of clearing delegation state for the associated
13 inode, nfs_inode_find_state_and_recover() gets called and it makes the
14 same state with RECLAIM_NOGRACE flag again. As a results, when we restart
15 looking over the open states, we end up in the infinite loop instead of
16 breaking out in the next test of state flags.
18 Solution: unset the RECLAIM_NOGRACE set because of
19 calling of nfs_inode_find_state_and_recover() after returning from calling
20 recover_open() function.
22 Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
23 Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
24 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27 fs/nfs/nfs4state.c | 2 ++
28 1 file changed, 2 insertions(+)
30 --- a/fs/nfs/nfs4state.c
31 +++ b/fs/nfs/nfs4state.c
32 @@ -1482,6 +1482,8 @@ restart:
33 spin_unlock(&state->state_lock);
35 nfs4_put_open_state(state);
36 + clear_bit(NFS4CLNT_RECLAIM_NOGRACE,
38 spin_lock(&sp->so_lock);