diff options
author | Weston Andros Adamson <dros@netapp.com> | 2012-05-24 12:26:37 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-05-24 16:26:21 -0400 |
commit | a9e64442f1399e9f6ceaeeeb03a26a560c949fac (patch) | |
tree | 6348c1eb0e1ed43ebc5cb6b40bf843d7cb954c76 | |
parent | 7c44f1ae4a21458a1ea3d6482ffb3136f1df6d2b (diff) |
nfs41: Use BIND_CONN_TO_SESSION for CB_PATH_DOWN*
The state manager can handle SEQ4_STATUS_CB_PATH_DOWN* flags with a
BIND_CONN_TO_SESSION instead of destroying the session and creating a new one.
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4_fs.h | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 34 |
2 files changed, 31 insertions, 4 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 2c7f1cf85b8f..5fcb1ad65e5e 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -25,6 +25,7 @@ enum nfs4_client_state { | |||
25 | NFS4CLNT_LEASE_CONFIRM, | 25 | NFS4CLNT_LEASE_CONFIRM, |
26 | NFS4CLNT_SERVER_SCOPE_MISMATCH, | 26 | NFS4CLNT_SERVER_SCOPE_MISMATCH, |
27 | NFS4CLNT_PURGE_STATE, | 27 | NFS4CLNT_PURGE_STATE, |
28 | NFS4CLNT_BIND_CONN_TO_SESSION, | ||
28 | }; | 29 | }; |
29 | 30 | ||
30 | enum nfs4_session_state { | 31 | enum nfs4_session_state { |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 32cce4a276e8..03fa802b5529 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1640,13 +1640,20 @@ static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp) | |||
1640 | nfs_expire_all_delegations(clp); | 1640 | nfs_expire_all_delegations(clp); |
1641 | } | 1641 | } |
1642 | 1642 | ||
1643 | static void nfs41_handle_cb_path_down(struct nfs_client *clp) | 1643 | static void nfs41_handle_backchannel_fault(struct nfs_client *clp) |
1644 | { | 1644 | { |
1645 | nfs_expire_all_delegations(clp); | 1645 | nfs_expire_all_delegations(clp); |
1646 | if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0) | 1646 | if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0) |
1647 | nfs4_schedule_state_manager(clp); | 1647 | nfs4_schedule_state_manager(clp); |
1648 | } | 1648 | } |
1649 | 1649 | ||
1650 | static void nfs41_handle_cb_path_down(struct nfs_client *clp) | ||
1651 | { | ||
1652 | if (test_and_set_bit(NFS4CLNT_BIND_CONN_TO_SESSION, | ||
1653 | &clp->cl_state) == 0) | ||
1654 | nfs4_schedule_state_manager(clp); | ||
1655 | } | ||
1656 | |||
1650 | void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags) | 1657 | void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags) |
1651 | { | 1658 | { |
1652 | if (!flags) | 1659 | if (!flags) |
@@ -1664,9 +1671,10 @@ void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags) | |||
1664 | nfs41_handle_state_revoked(clp); | 1671 | nfs41_handle_state_revoked(clp); |
1665 | if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED) | 1672 | if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED) |
1666 | nfs41_handle_recallable_state_revoked(clp); | 1673 | nfs41_handle_recallable_state_revoked(clp); |
1667 | if (flags & (SEQ4_STATUS_CB_PATH_DOWN | | 1674 | if (flags & SEQ4_STATUS_BACKCHANNEL_FAULT) |
1668 | SEQ4_STATUS_BACKCHANNEL_FAULT | | 1675 | nfs41_handle_backchannel_fault(clp); |
1669 | SEQ4_STATUS_CB_PATH_DOWN_SESSION)) | 1676 | else if (flags & (SEQ4_STATUS_CB_PATH_DOWN | |
1677 | SEQ4_STATUS_CB_PATH_DOWN_SESSION)) | ||
1670 | nfs41_handle_cb_path_down(clp); | 1678 | nfs41_handle_cb_path_down(clp); |
1671 | } | 1679 | } |
1672 | 1680 | ||
@@ -1691,6 +1699,7 @@ static int nfs4_reset_session(struct nfs_client *clp) | |||
1691 | clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); | 1699 | clear_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state); |
1692 | /* create_session negotiated new slot table */ | 1700 | /* create_session negotiated new slot table */ |
1693 | clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state); | 1701 | clear_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state); |
1702 | clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, &clp->cl_state); | ||
1694 | 1703 | ||
1695 | /* Let the state manager reestablish state */ | 1704 | /* Let the state manager reestablish state */ |
1696 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) | 1705 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) |
@@ -1727,10 +1736,19 @@ static int nfs4_recall_slot(struct nfs_client *clp) | |||
1727 | return 0; | 1736 | return 0; |
1728 | } | 1737 | } |
1729 | 1738 | ||
1739 | static int nfs4_bind_conn_to_session(struct nfs_client *clp) | ||
1740 | { | ||
1741 | return nfs4_proc_bind_conn_to_session(clp); | ||
1742 | } | ||
1730 | #else /* CONFIG_NFS_V4_1 */ | 1743 | #else /* CONFIG_NFS_V4_1 */ |
1731 | static int nfs4_reset_session(struct nfs_client *clp) { return 0; } | 1744 | static int nfs4_reset_session(struct nfs_client *clp) { return 0; } |
1732 | static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; } | 1745 | static int nfs4_end_drain_session(struct nfs_client *clp) { return 0; } |
1733 | static int nfs4_recall_slot(struct nfs_client *clp) { return 0; } | 1746 | static int nfs4_recall_slot(struct nfs_client *clp) { return 0; } |
1747 | |||
1748 | static int nfs4_bind_conn_to_session(struct nfs_client *clp) | ||
1749 | { | ||
1750 | return 0; | ||
1751 | } | ||
1734 | #endif /* CONFIG_NFS_V4_1 */ | 1752 | #endif /* CONFIG_NFS_V4_1 */ |
1735 | 1753 | ||
1736 | /* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors | 1754 | /* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors |
@@ -1814,6 +1832,14 @@ static void nfs4_state_manager(struct nfs_client *clp) | |||
1814 | goto out_error; | 1832 | goto out_error; |
1815 | } | 1833 | } |
1816 | 1834 | ||
1835 | /* Send BIND_CONN_TO_SESSION */ | ||
1836 | if (test_and_clear_bit(NFS4CLNT_BIND_CONN_TO_SESSION, | ||
1837 | &clp->cl_state) && nfs4_has_session(clp)) { | ||
1838 | status = nfs4_bind_conn_to_session(clp); | ||
1839 | if (status < 0) | ||
1840 | goto out_error; | ||
1841 | } | ||
1842 | |||
1817 | /* First recover reboot state... */ | 1843 | /* First recover reboot state... */ |
1818 | if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { | 1844 | if (test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) { |
1819 | status = nfs4_do_reclaim(clp, | 1845 | status = nfs4_do_reclaim(clp, |