1 From b0ed9dbc24f1fd912b2dd08b995153cafc1d5b1c Mon Sep 17 00:00:00 2001
2 From: Trond Myklebust <Trond.Myklebust@netapp.com>
3 Date: Mon, 4 Oct 2010 17:59:08 -0400
4 Subject: NFSv4: Fix open recovery
6 From: Trond Myklebust <Trond.Myklebust@netapp.com>
8 commit b0ed9dbc24f1fd912b2dd08b995153cafc1d5b1c upstream.
10 NFSv4 open recovery is currently broken: since we do not clear the
11 state->flags states before attempting recovery, we end up with the
12 'can_open_cached()' function triggering. This again leads to no OPEN call
13 being put on the wire.
15 Reported-by: Sachin Prabhu <sprabhu@redhat.com>
16 Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
20 fs/nfs/nfs4proc.c | 3 +++
21 1 file changed, 3 insertions(+)
23 --- a/fs/nfs/nfs4proc.c
24 +++ b/fs/nfs/nfs4proc.c
25 @@ -1117,6 +1117,7 @@ static int nfs4_open_recover(struct nfs4
26 clear_bit(NFS_DELEGATED_STATE, &state->flags);
28 if (state->n_rdwr != 0) {
29 + clear_bit(NFS_O_RDWR_STATE, &state->flags);
30 ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE, &newstate);
33 @@ -1124,6 +1125,7 @@ static int nfs4_open_recover(struct nfs4
36 if (state->n_wronly != 0) {
37 + clear_bit(NFS_O_WRONLY_STATE, &state->flags);
38 ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate);
41 @@ -1131,6 +1133,7 @@ static int nfs4_open_recover(struct nfs4
44 if (state->n_rdonly != 0) {
45 + clear_bit(NFS_O_RDONLY_STATE, &state->flags);
46 ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate);