]>
Commit | Line | Data |
---|---|---|
739e1c91 GKH |
1 | From 2bee72a6aa1e6d0a4f5da56217f0d0bbbdd0d9a3 Mon Sep 17 00:00:00 2001 |
2 | From: Trond Myklebust <Trond.Myklebust@netapp.com> | |
3 | Date: Tue, 26 Jan 2010 15:42:21 -0500 | |
4 | Subject: NFSv4: Ensure that the NFSv4 locking can recover from stateid errors | |
5 | ||
6 | From: Trond Myklebust <Trond.Myklebust@netapp.com> | |
7 | ||
8 | commit 2bee72a6aa1e6d0a4f5da56217f0d0bbbdd0d9a3 upstream. | |
9 | ||
10 | In most cases, we just want to mark the lock_stateid sequence id as being | |
11 | uninitialised. | |
12 | ||
13 | Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com> | |
14 | Reviewed-by: Chuck Lever <chuck.lever@oracle.com> | |
15 | Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> | |
16 | ||
17 | --- | |
18 | fs/nfs/nfs4proc.c | 19 +++++++++++++++++++ | |
19 | 1 file changed, 19 insertions(+) | |
20 | ||
21 | --- a/fs/nfs/nfs4proc.c | |
22 | +++ b/fs/nfs/nfs4proc.c | |
23 | @@ -3978,6 +3978,22 @@ static const struct rpc_call_ops nfs4_lo | |
24 | .rpc_release = nfs4_lock_release, | |
25 | }; | |
26 | ||
27 | +static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_state *lsp, int new_lock_owner, int error) | |
28 | +{ | |
29 | + struct nfs_client *clp = server->nfs_client; | |
30 | + struct nfs4_state *state = lsp->ls_state; | |
31 | + | |
32 | + switch (error) { | |
33 | + case -NFS4ERR_ADMIN_REVOKED: | |
34 | + case -NFS4ERR_BAD_STATEID: | |
35 | + case -NFS4ERR_EXPIRED: | |
36 | + if (new_lock_owner != 0 || | |
37 | + (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) | |
38 | + nfs4_state_mark_reclaim_nograce(clp, state); | |
39 | + lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED; | |
40 | + }; | |
41 | +} | |
42 | + | |
43 | static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *fl, int reclaim) | |
44 | { | |
45 | struct nfs4_lockdata *data; | |
46 | @@ -4013,6 +4029,9 @@ static int _nfs4_do_setlk(struct nfs4_st | |
47 | ret = nfs4_wait_for_completion_rpc_task(task); | |
48 | if (ret == 0) { | |
49 | ret = data->rpc_status; | |
50 | + if (ret) | |
51 | + nfs4_handle_setlk_error(data->server, data->lsp, | |
52 | + data->arg.new_lock_owner, ret); | |
53 | } else | |
54 | data->cancelled = 1; | |
55 | rpc_put_task(task); |