aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4state.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2012-06-05 11:19:47 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-06-28 17:20:49 -0400
commitb42353ff8d346a2f6afac3e3983b7286ed4238d7 (patch)
tree88b36973679aaec1b1315f6319f55aed04141ce9 /fs/nfs/nfs4state.c
parent1a47e7a6662f155c8118d64737086a72cf34edf1 (diff)
NFSv4.1: Clean up nfs4_reclaim_lease
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4state.c')
-rw-r--r--fs/nfs/nfs4state.c52
1 files changed, 35 insertions, 17 deletions
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index d04e0a1c0234..1cfc4603fd9a 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1642,7 +1642,7 @@ static int nfs4_handle_reclaim_lease_error(struct nfs_client *clp, int status)
1642 return 0; 1642 return 0;
1643} 1643}
1644 1644
1645static int nfs4_reclaim_lease(struct nfs_client *clp) 1645static int nfs4_establish_lease(struct nfs_client *clp)
1646{ 1646{
1647 struct rpc_cred *cred; 1647 struct rpc_cred *cred;
1648 const struct nfs4_state_recovery_ops *ops = 1648 const struct nfs4_state_recovery_ops *ops =
@@ -1655,7 +1655,37 @@ static int nfs4_reclaim_lease(struct nfs_client *clp)
1655 status = ops->establish_clid(clp, cred); 1655 status = ops->establish_clid(clp, cred);
1656 put_rpccred(cred); 1656 put_rpccred(cred);
1657 if (status != 0) 1657 if (status != 0)
1658 return status;
1659 pnfs_destroy_all_layouts(clp);
1660 return 0;
1661}
1662
1663static int nfs4_reclaim_lease(struct nfs_client *clp)
1664{
1665 int status;
1666
1667 status = nfs4_establish_lease(clp);
1668 if (status < 0)
1669 return nfs4_handle_reclaim_lease_error(clp, status);
1670 if (test_and_clear_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH, &clp->cl_state))
1671 nfs4_state_start_reclaim_nograce(clp);
1672 if (!test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state))
1673 set_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state);
1674 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
1675 clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1676 return 0;
1677}
1678
1679static int nfs4_purge_lease(struct nfs_client *clp)
1680{
1681 int status;
1682
1683 status = nfs4_establish_lease(clp);
1684 if (status < 0)
1658 return nfs4_handle_reclaim_lease_error(clp, status); 1685 return nfs4_handle_reclaim_lease_error(clp, status);
1686 clear_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state);
1687 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1688 nfs4_state_start_reclaim_nograce(clp);
1659 return 0; 1689 return 0;
1660} 1690}
1661 1691
@@ -1868,31 +1898,19 @@ static void nfs4_state_manager(struct nfs_client *clp)
1868 do { 1898 do {
1869 if (test_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) { 1899 if (test_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state)) {
1870 section = "purge state"; 1900 section = "purge state";
1871 status = nfs4_reclaim_lease(clp); 1901 status = nfs4_purge_lease(clp);
1872 if (status < 0) 1902 if (status < 0)
1873 goto out_error; 1903 goto out_error;
1874 clear_bit(NFS4CLNT_PURGE_STATE, &clp->cl_state); 1904 continue;
1875 set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
1876 } 1905 }
1877 1906
1878 if (test_and_clear_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) { 1907 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {
1879 section = "lease expired"; 1908 section = "lease expired";
1880 /* We're going to have to re-establish a clientid */ 1909 /* We're going to have to re-establish a clientid */
1881 status = nfs4_reclaim_lease(clp); 1910 status = nfs4_reclaim_lease(clp);
1882 if (status < 0) 1911 if (status < 0)
1883 goto out_error; 1912 goto out_error;
1884 if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) 1913 continue;
1885 continue;
1886 clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state);
1887
1888 if (test_and_clear_bit(NFS4CLNT_SERVER_SCOPE_MISMATCH,
1889 &clp->cl_state))
1890 nfs4_state_start_reclaim_nograce(clp);
1891 else
1892 set_bit(NFS4CLNT_RECLAIM_REBOOT,
1893 &clp->cl_state);
1894
1895 pnfs_destroy_all_layouts(clp);
1896 } 1914 }
1897 1915
1898 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) { 1916 if (test_and_clear_bit(NFS4CLNT_CHECK_LEASE, &clp->cl_state)) {