nfs4.1: add BIND_CONN_TO_SESSION operation
Subsystems (2)
PATCH 1/2 nfs4.1: add BIND_CONN_TO_SESSION operation
This patch adds the BIND_CONN_TO_SESSION operation which is needed for upcoming SP4_MACH_CRED work and useful for recovering from broken connections without destroying the session.
Signed-off-by Weston Andros Adamson <[email protected]>
---
Updated with comment from Trond
fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4proc.c | 54 ++++++++++++++++++++++++++ fs/nfs/nfs4xdr.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/nfs4.h | 5 ++ include/linux/nfs_xdr.h | 6 +++ 5 files changed, 161 insertions(+), 0 deletions(-)
fs/nfs/nfs4_fs.h +1 -0
@@ -215,6 +215,7 @@ struct vfsmount *nfs4_submount(struct nfs_server *, struct dentry *,extern int nfs4_proc_setclientid (struct nfs_client *,u32 ,unsigned short ,struct rpc_cred *,struct nfs4_setclientid_res *);extern int nfs4_proc_setclientid_confirm (struct nfs_client *,struct nfs4_setclientid_res *arg,struct rpc_cred *);extern int nfs4_proc_get_rootfh (struct nfs_server *,struct nfs_fh *,struct nfs_fsinfo *); +extern int nfs4_proc_bind_conn_to_session (struct nfs_client *);extern int nfs4_proc_exchange_id (struct nfs_client *clp,struct rpc_cred *cred);extern int nfs4_init_clientid (struct nfs_client *,struct rpc_cred *);extern int nfs41_init_clientid (struct nfs_client *,struct rpc_cred *);
fs/nfs/nfs4proc.c +54 -0
60 lines not on this page · raw message
fs/nfs/nfs4xdr.c +95 -0
137 lines not on this page · raw message
include/linux/nfs4.h +5 -0
@@ -69,6 +69,10 @@#define NFS4_CDFC4_FORE_OR_BOTH 0x3#define NFS4_CDFC4_BACK_OR_BOTH 0x7 +#define NFS4_CDFS4_FORE 0x1 +#define NFS4_CDFS4_BACK 0x2 +#define NFS4_CDFS4_BOTH 0x3 +#define NFS4_SET_TO_SERVER_TIME 0#define NFS4_SET_TO_CLIENT_TIME 1
@@ -582,6 +586,7 @@ enum {NFSPROC4_CLNT_SECINFO ,/* nfs41 */ +NFSPROC4_CLNT_BIND_CONN_TO_SESSION ,NFSPROC4_CLNT_EXCHANGE_ID ,NFSPROC4_CLNT_CREATE_SESSION , NFSPROC4_CLNT_DESTROY_SESSION,
include/linux/nfs_xdr.h +6 -0
@@ -1115,6 +1115,12 @@ struct nfs41_impl_id {struct nfstime4 date; }; +struct nfs41_bind_conn_to_session_res { +struct nfs4_session *session; +u32 dir; +bool use_conn_in_rdma_mode; +}; +struct nfs41_exchange_id_res {struct nfs_client *client;u32 flags;
Signature · 1 line
1.7.4.4
PATCH 2/2 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 <[email protected]>
---
Updated with comments from Trond.
I got to remember to test with different CONFIG options *after* I clean up the patch :)
fs/nfs/nfs4_fs.h | 1 + fs/nfs/nfs4state.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-)
fs/nfs/nfs4_fs.h +1 -0
@@ -24,6 +24,7 @@ enum nfs4_client_state {NFS4CLNT_RECALL_SLOT ,NFS4CLNT_LEASE_CONFIRM ,NFS4CLNT_SERVER_SCOPE_MISMATCH , + NFS4CLNT_BIND_CONN_TO_SESSION, }; enum nfs4_session_state {
fs/nfs/nfs4state.c +27 -4
@@ -1639,13 +1639,20 @@ static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp)nfs_expire_all_delegations (clp); } -static void nfs41_handle_cb_path_down (struct nfs_client *clp) +static void nfs41_handle_backchannel_fault (struct nfs_client *clp) {nfs_expire_all_delegations (clp);if (test_and_set_bit (NFS4CLNT_SESSION_RESET , &clp->cl_state) ==0 )nfs4_schedule_state_manager (clp); } +static void nfs41_handle_cb_path_down (struct nfs_client *clp) +{ +if (test_and_set_bit (NFS4CLNT_BIND_CONN_TO_SESSION , + &clp->cl_state) ==0 ) +nfs4_schedule_state_manager (clp); +} +void nfs41_handle_sequence_flag_errors (struct nfs_client *clp,u32 flags) {if (!flags)
@@ -1659,9 +1666,10 @@ void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)nfs41_handle_state_revoked (clp);if (flags &SEQ4_STATUS_RECALLABLE_STATE_REVOKED )nfs41_handle_recallable_state_revoked (clp); -if (flags & (SEQ4_STATUS_CB_PATH_DOWN | -SEQ4_STATUS_BACKCHANNEL_FAULT | -SEQ4_STATUS_CB_PATH_DOWN_SESSION )) +if (flags &SEQ4_STATUS_BACKCHANNEL_FAULT ) +nfs41_handle_backchannel_fault (clp); +else if (flags & (SEQ4_STATUS_CB_PATH_DOWN | +SEQ4_STATUS_CB_PATH_DOWN_SESSION ))nfs41_handle_cb_path_down (clp); }
@@ -1686,6 +1694,7 @@ static int nfs4_reset_session(struct nfs_client *clp)clear_bit (NFS4CLNT_SESSION_RESET , &clp->cl_state);/* create_session negotiated new slot table */ clear_bit (NFS4CLNT_RECALL_SLOT , &clp->cl_state); +clear_bit (NFS4CLNT_BIND_CONN_TO_SESSION , &clp->cl_state);/* Let the state manager reestablish state */ if (!test_bit (NFS4CLNT_LEASE_EXPIRED , &clp->cl_state))
@@ -1722,10 +1731,15 @@ static int nfs4_recall_slot(struct nfs_client *clp) return 0; } +static int nfs4_do_bind_conn_to_session (struct nfs_client *clp) +{ +return nfs4_proc_bind_conn_to_session (clp); +}#else /* CONFIG_NFS_V4_1 */ static int nfs4_reset_session (struct nfs_client *clp) {return 0 ; }static int nfs4_end_drain_session (struct nfs_client *clp) {return 0 ; }static int nfs4_recall_slot (struct nfs_client *clp) {return 0 ; } +static int nfs4_do_bind_conn_to_session (struct nfs_client *clp) {return 0 ; }#endif /* CONFIG_NFS_V4_1 */ /* Set NFS4CLNT_LEASE_EXPIRED for all v4.0 errors and for recoverable errors
@@ -1803,6 +1817,15 @@ static void nfs4_state_manager(struct nfs_client *clp) goto out_error; } +/* Send BIND_CONN_TO_SESSION */ +if (clp->cl_mvops->minor_version ==1 && +test_and_clear_bit (NFS4CLNT_BIND_CONN_TO_SESSION , + &clp->cl_state) &&nfs4_has_session (clp)) { + status =nfs4_do_bind_conn_to_session (clp); +if (status <0 ) + goto out_error; + } +/* First recover reboot state... */ if (test_bit (NFS4CLNT_RECLAIM_REBOOT , &clp->cl_state)) { status = nfs4_do_reclaim(clp,
Signature · 1 line
1.7.4.4