]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount
authorOlga Kornievskaia <aglo@umich.edu>
Mon, 14 Sep 2015 23:54:36 +0000 (19:54 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Thu, 17 Sep 2015 19:48:11 +0000 (15:48 -0400)
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: Olga Kornievskaia <aglo@umich.edu>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/nfs4state.c

index da73bc4432385748a5224a4fddf302ab2bb11cfa..5db324635e920a51923b37c3d22c9d3dee2f6682 100644 (file)
@@ -1481,7 +1481,7 @@ restart:
                                        spin_unlock(&state->state_lock);
                                }
                                nfs4_put_open_state(state);
-                               clear_bit(NFS4CLNT_RECLAIM_NOGRACE,
+                               clear_bit(NFS_STATE_RECLAIM_NOGRACE,
                                        &state->flags);
                                spin_lock(&sp->so_lock);
                                goto restart;