Commit a41cbe86 authored by Olga Kornievskaia's avatar Olga Kornievskaia Committed by Trond Myklebust

Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount

A test case is as the description says:
open(foobar, O_WRONLY);
sleep()  --> reboot the server
close(foobar)

The bug is because in nfs4state.c in nfs4_reclaim_open_state() a few
line before going to restart, there is
clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &state->flags).

NFS4CLNT_RECLAIM_NOGRACE is a flag for the client states not open
owner states. Value of NFS4CLNT_RECLAIM_NOGRACE is 4 which is the
value of NFS_O_WRONLY_STATE in nfs4_state->flags. So clearing it wipes
out state and when we go to close it, “call_close” doesn’t get set as
state flag is not set and CLOSE doesn’t go on the wire.
Signed-off-by: default avatarOlga Kornievskaia <aglo@umich.edu>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 6ff33f39
...@@ -1481,7 +1481,7 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs ...@@ -1481,7 +1481,7 @@ static int nfs4_reclaim_open_state(struct nfs4_state_owner *sp, const struct nfs
spin_unlock(&state->state_lock); spin_unlock(&state->state_lock);
} }
nfs4_put_open_state(state); nfs4_put_open_state(state);
clear_bit(NFS4CLNT_RECLAIM_NOGRACE, clear_bit(NFS_STATE_RECLAIM_NOGRACE,
&state->flags); &state->flags);
spin_lock(&sp->so_lock); spin_lock(&sp->so_lock);
goto restart; goto restart;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment