NFSv4: Always drain the slot table before re-establishing the lease
authorTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 1 Jun 2015 14:30:11 +0000 (10:30 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 2 Jun 2015 12:55:27 +0000 (08:55 -0400)
While the NFSv4.1 code has always drained the slot tables in order to stop
non-recovery related RPC calls when doing lease recovery, the NFSv4 code
did not.
The reason for the difference in behaviour is that NFSv4 does not have
session state, and so RPC calls can in theory proceed while recovery is
happening. In practice, however, anything I/O or state related needs to
wait until recovery is over.

This patch changes the behaviour of NFSv4 to match that of NFSv4.1 so that
we can simplify the state recovery code by assuming that we do not have to
deal with races between recovery and ordinary I/O.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/nfs4state.c

index ddef1dc80cf7d7c88b9202bf01746c3497bacf28..605840dc89cf9e28c173659af201aab109f9328d 100644 (file)
@@ -309,7 +309,6 @@ int nfs41_init_clientid(struct nfs_client *clp, struct rpc_cred *cred)
 
        if (test_bit(NFS4CLNT_LEASE_CONFIRM, &clp->cl_state))
                goto do_confirm;
-       nfs4_begin_drain_session(clp);
        status = nfs4_proc_exchange_id(clp, cred);
        if (status != 0)
                goto out;
@@ -1832,6 +1831,7 @@ static int nfs4_establish_lease(struct nfs_client *clp)
                clp->cl_mvops->reboot_recovery_ops;
        int status;
 
+       nfs4_begin_drain_session(clp);
        cred = nfs4_get_clid_cred(clp);
        if (cred == NULL)
                return -ENOENT;