]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.4.181/nfs4-fix-v4.0-client-state-corruption-when-mount.patch
Linux 4.4.181
[thirdparty/kernel/stable-queue.git] / releases / 4.4.181 / nfs4-fix-v4.0-client-state-corruption-when-mount.patch
1 From f02f3755dbd14fb935d24b14650fff9ba92243b8 Mon Sep 17 00:00:00 2001
2 From: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
3 Date: Mon, 6 May 2019 11:57:03 +0800
4 Subject: NFS4: Fix v4.0 client state corruption when mount
5
6 From: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
7
8 commit f02f3755dbd14fb935d24b14650fff9ba92243b8 upstream.
9
10 stat command with soft mount never return after server is stopped.
11
12 When alloc a new client, the state of the client will be set to
13 NFS4CLNT_LEASE_EXPIRED.
14
15 When the server is stopped, the state manager will work, and accord
16 the state to recover. But the state is NFS4CLNT_LEASE_EXPIRED, it
17 will drain the slot table and lead other task to wait queue, until
18 the client recovered. Then the stat command is hung.
19
20 When discover server trunking, the client will renew the lease,
21 but check the client state, it lead the client state corruption.
22
23 So, we need to call state manager to recover it when detect server
24 ip trunking.
25
26 Signed-off-by: ZhangXiaoxu <zhangxiaoxu5@huawei.com>
27 Cc: stable@vger.kernel.org
28 Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 fs/nfs/nfs4state.c | 4 ++++
33 1 file changed, 4 insertions(+)
34
35 --- a/fs/nfs/nfs4state.c
36 +++ b/fs/nfs/nfs4state.c
37 @@ -140,6 +140,10 @@ int nfs40_discover_server_trunking(struc
38 /* Sustain the lease, even if it's empty. If the clientid4
39 * goes stale it's of no use for trunking discovery. */
40 nfs4_schedule_state_renewal(*result);
41 +
42 + /* If the client state need to recover, do it. */
43 + if (clp->cl_state)
44 + nfs4_schedule_state_manager(clp);
45 }
46 out:
47 return status;