Simple-minded server fixes for sidecar backchannel
Subsystems (3)
cover Simple-minded server fixes for sidecar backchannel
Hi Bruce-
I've been testing these for my client backchannel work. These are a naive first pass at fixing server issues with multiple connections per session.
---
Chuck Lever (4):
nfsd: Assert SEQ4_STATUS_CB_PATH_DOWN_SESSION
nfsd: Mark back channel down if SESSION4_BACK_CHAN is clear
NFSD: Always initialize cl_cb_addr
sunrpc: fix byte-swapping of displayed XID
fs/nfsd/nfs4state.c | 8 ++++++-- net/sunrpc/svcsock.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-)
Signature · 1 line
Chuck Lever
PATCH 1/4 sunrpc: fix byte-swapping of displayed XID
xprt_lookup_rqst() and bc_send_request() display a byte-swapped XID, but receive_cb_reply() does not.
---
net/sunrpc/svcsock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/sunrpc/svcsock.c +1 -1
@@ -1036,7 +1036,7 @@ static int receive_cb_reply(struct svc_sock *svsk, struct svc_rqst *rqstp)"%s: Got unrecognized reply: " "calldir 0x%x xpt_bc_xprt %p xid %08x\n" , __func__,ntohl (calldir), - bc_xprt, xid); + bc_xprt, ntohl(xid));return -EAGAIN ; }
Re: [PATCH 1/4] sunrpc: fix byte-swapping of displayed XID
Quoted 2 lines · Chuck Lever
xprt_lookup_rqst()andbc_send_request()display a byte-swapped XID, butreceive_cb_reply()does not.
Thanks, applying.--b.
Quoted 21 lines
Signed-off-by Chuck Lever <[email protected]>---
net/sunrpc/svcsock.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)net/sunrpc/svcsock.c +1
-1@@ -1036,7 +1036,7 @@ static int receive_cb_reply(struct svc_sock *svsk, struct svc_rqst *rqstp)"%s: Got unrecognized reply: " "calldir 0x%x xpt_bc_xprt %p xid %08x\n" , __func__,ntohl (calldir), - bc_xprt, xid); + bc_xprt, ntohl(xid));return -EAGAIN ; }
PATCH 2/4 NFSD: Always initialize cl_cb_addr
In reply to Chuck LeverA client may not want to use the back channel on a transport it sent CREATE_SESSION on, in which case it clears SESSION4_BACK_CHAN.
However, cl_cb_addr should be populated anyway, to be used if the client binds other connections to this session. If cl_cb_addr is not initialized, rpc_create() fails when the server attempts to set up a back channel on such secondary transports.
---
fs/nfsd/nfs4state.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
fs/nfsd/nfs4state.c +1 -1
@@ -1429,7 +1429,7 @@ static void init_session(struct svc_rqst *rqstp, struct nfsd4_session *new, strulist_add (&new->se_perclnt, &clp->cl_sessions);spin_unlock (&clp->cl_lock); -if (cses->flags &SESSION4_BACK_CHAN ) { + {struct sockaddr *sa =svc_addr (rqstp);/* * This is a little silly; with sessions there's no real
Re: [PATCH 2/4] NFSD: Always initialize cl_cb_addr
Quoted 7 lines · Chuck Lever
A client may not want to use the back channel on a transport it sent
CREATE_SESSIONon, in which case it clearsSESSION4_BACK_CHAN.However,
cl_cb_addrshould be populated anyway, to be used if the client binds other connections to this session. Ifcl_cb_addris not initialized,rpc_create()fails when the server attempts to set up a back channel on such secondary transports.
OK, applying.--b.
Quoted 21 lines
Signed-off-by Chuck Lever <[email protected]>---
fs/nfsd/nfs4state.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)fs/nfsd/nfs4state.c +1
-1@@ -1429,7 +1429,7 @@ static void init_session(struct svc_rqst *rqstp, struct nfsd4_session *new, strulist_add (&new->se_perclnt, &clp->cl_sessions);spin_unlock (&clp->cl_lock); -if (cses->flags &SESSION4_BACK_CHAN ) { + {struct sockaddr *sa =svc_addr (rqstp);/* * This is a little silly; with sessions there's no real
PATCH 3/4 nfsd: Mark back channel down if SESSION4_BACK_CHAN is clear
In reply to Chuck LeverIf a client indicates via CREATE_SESSION that no back channel should be used on the existing connection, mark the client's cl_cb_state DOWN instead of leaving it UNKNOWN.
Otherwise, a fresh session is created without an operational backchannel, but the server never asserts SEQ4_STATUS_CB_PATH_DOWN.
---
fs/nfsd/nfs4state.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
fs/nfsd/nfs4state.c +3 -0
@@ -1429,6 +1429,9 @@ static void init_session(struct svc_rqst *rqstp, struct nfsd4_session *new, strulist_add (&new->se_perclnt, &clp->cl_sessions);spin_unlock (&clp->cl_lock); +if (!(cses->flags &SESSION4_BACK_CHAN )) + clp->cl_cb_state =NFSD4_CB_DOWN ; + {struct sockaddr *sa =svc_addr (rqstp);/*
PATCH 4/4 nfsd: Assert SEQ4_STATUS_CB_PATH_DOWN_SESSION
In reply to Chuck LeverThe NFS server should assert both CB_PATH_DOWN and CB_PATH_DOWN_SESSION when there is no backchannel.
RFC 5661 section 18.46.3:
SEQ4_STATUS_CB_PATH_DOWN
When set, indicates that the client has no operational backchannel path for any session associated with the client ID, making it necessary for the client to re-establish one. This bit remains set on all SEQUENCE responses on all sessions associated with the client ID until at least one backchannel is available on any session associated with the client ID.
SEQ4_STATUS_CB_PATH_DOWN_SESSION
When set, indicates that the session has no operational backchannel. . .
. . . The SEQ4_STATUS_CB_PATH_DOWN_SESSION bit is the
indication to the client that it needs to associate a connection to the session’s backchannel. This bit remains set on all SEQUENCE responses of the session until a connection is associated with the session’s a backchannel.
The Linux server doesn't currently make a distinction between these cases, so both flags should be asserted unconditionally.
---
fs/nfsd/nfs4state.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
fs/nfsd/nfs4state.c +2 -1
@@ -2805,7 +2805,8 @@ nfsd4_sequence(struct svc_rqst *rqstp, out:switch (clp->cl_cb_state) {case NFSD4_CB_DOWN : - seq->status_flags =SEQ4_STATUS_CB_PATH_DOWN ; + seq->status_flags =SEQ4_STATUS_CB_PATH_DOWN | +SEQ4_STATUS_CB_PATH_DOWN_SESSION ;break ;case NFSD4_CB_FAULT : seq->status_flags =SEQ4_STATUS_BACKCHANNEL_FAULT ;