]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.7/nfsv4-fix-open-lock-state-recovery-error-handling.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.7 / nfsv4-fix-open-lock-state-recovery-error-handling.patch
1 From df817ba35736db2d62b07de6f050a4db53492ad8 Mon Sep 17 00:00:00 2001
2 From: Trond Myklebust <trond.myklebust@primarydata.com>
3 Date: Sat, 27 Sep 2014 17:41:51 -0400
4 Subject: NFSv4: fix open/lock state recovery error handling
5
6 From: Trond Myklebust <trond.myklebust@primarydata.com>
7
8 commit df817ba35736db2d62b07de6f050a4db53492ad8 upstream.
9
10 The current open/lock state recovery unfortunately does not handle errors
11 such as NFS4ERR_CONN_NOT_BOUND_TO_SESSION correctly. Instead of looping,
12 just proceeds as if the state manager is finished recovering.
13 This patch ensures that we loop back, handle higher priority errors
14 and complete the open/lock state recovery.
15
16 Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19 ---
20 fs/nfs/nfs4state.c | 16 ++++++----------
21 1 file changed, 6 insertions(+), 10 deletions(-)
22
23 --- a/fs/nfs/nfs4state.c
24 +++ b/fs/nfs/nfs4state.c
25 @@ -1732,7 +1732,8 @@ restart:
26 if (status < 0) {
27 set_bit(ops->owner_flag_bit, &sp->so_flags);
28 nfs4_put_state_owner(sp);
29 - return nfs4_recovery_handle_error(clp, status);
30 + status = nfs4_recovery_handle_error(clp, status);
31 + return (status != 0) ? status : -EAGAIN;
32 }
33
34 nfs4_put_state_owner(sp);
35 @@ -1741,7 +1742,7 @@ restart:
36 spin_unlock(&clp->cl_lock);
37 }
38 rcu_read_unlock();
39 - return status;
40 + return 0;
41 }
42
43 static int nfs4_check_lease(struct nfs_client *clp)
44 @@ -2393,14 +2394,11 @@ static void nfs4_state_manager(struct nf
45 section = "reclaim reboot";
46 status = nfs4_do_reclaim(clp,
47 clp->cl_mvops->reboot_recovery_ops);
48 - if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
49 - test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
50 - continue;
51 - nfs4_state_end_reclaim_reboot(clp);
52 - if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state))
53 + if (status == -EAGAIN)
54 continue;
55 if (status < 0)
56 goto out_error;
57 + nfs4_state_end_reclaim_reboot(clp);
58 }
59
60 /* Now recover expired state... */
61 @@ -2408,9 +2406,7 @@ static void nfs4_state_manager(struct nf
62 section = "reclaim nograce";
63 status = nfs4_do_reclaim(clp,
64 clp->cl_mvops->nograce_recovery_ops);
65 - if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
66 - test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) ||
67 - test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
68 + if (status == -EAGAIN)
69 continue;
70 if (status < 0)
71 goto out_error;