Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107408249
D30153.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D30153.diff
View Options
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -721,8 +721,8 @@
cbprogram, NFSV4_CBVERS);
if (clp->lc_req.nr_client != NULL) {
SVC_ACQUIRE(nd->nd_xprt);
- nd->nd_xprt->xp_p2 =
- clp->lc_req.nr_client->cl_private;
+ CLNT_ACQUIRE(clp->lc_req.nr_client);
+ nd->nd_xprt->xp_p2 = clp->lc_req.nr_client;
/* Disable idle timeout. */
nd->nd_xprt->xp_idletimeout = 0;
nsep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
@@ -6464,8 +6464,8 @@
"backchannel\n");
savxprt = sep->sess_cbsess.nfsess_xprt;
SVC_ACQUIRE(nd->nd_xprt);
- nd->nd_xprt->xp_p2 =
- clp->lc_req.nr_client->cl_private;
+ CLNT_ACQUIRE(clp->lc_req.nr_client);
+ nd->nd_xprt->xp_p2 = clp->lc_req.nr_client;
/* Disable idle timeout. */
nd->nd_xprt->xp_idletimeout = 0;
sep->sess_cbsess.nfsess_xprt = nd->nd_xprt;
diff --git a/sys/rpc/clnt_bck.c b/sys/rpc/clnt_bck.c
--- a/sys/rpc/clnt_bck.c
+++ b/sys/rpc/clnt_bck.c
@@ -566,15 +566,26 @@
/*
* This call is done by the svc code when a backchannel RPC reply is
* received.
+ * For the server end, where callback RPCs to the client are performed,
+ * xp_p2 points to the "CLIENT" and not the associated "struct ct_data"
+ * so that svc_vc_destroy() can CLNT_RELEASE() the reference count on it.
*/
void
clnt_bck_svccall(void *arg, struct mbuf *mrep, uint32_t xid)
{
- struct ct_data *ct = (struct ct_data *)arg;
+ CLIENT *cl = (CLIENT *)arg;
+ struct ct_data *ct;
struct ct_request *cr;
int foundreq;
+ ct = (struct ct_data *)cl->cl_private;
mtx_lock(&ct->ct_lock);
+ if (ct->ct_closing || ct->ct_closed) {
+ mtx_unlock(&ct->ct_lock);
+ m_freem(mrep);
+ return;
+ }
+
ct->ct_upcallrefs++;
/*
* See if we can match this reply to a request.
diff --git a/sys/rpc/svc.h b/sys/rpc/svc.h
--- a/sys/rpc/svc.h
+++ b/sys/rpc/svc.h
@@ -148,6 +148,11 @@
* reference count which tracks the number of currently assigned
* worker threads plus one for the service pool's reference.
* For NFSv4.1 sessions, a reference is also held for a backchannel.
+ * xp_p2 - Points to the CLIENT structure for the RPC server end
+ * (the client end for callbacks).
+ * Points to the private structure (cl_private) for the
+ * CLIENT structure for the RPC client end (the server
+ * end for callbacks).
*/
typedef struct __rpc_svcxprt {
#ifdef _KERNEL
diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c
--- a/sys/rpc/svc_vc.c
+++ b/sys/rpc/svc_vc.c
@@ -500,6 +500,7 @@
svc_vc_destroy(SVCXPRT *xprt)
{
struct cf_conn *cd = (struct cf_conn *)xprt->xp_p1;
+ CLIENT *cl = (CLIENT *)xprt->xp_p2;
SOCKBUF_LOCK(&xprt->xp_socket->so_rcv);
if (xprt->xp_upcallset) {
@@ -509,6 +510,9 @@
}
SOCKBUF_UNLOCK(&xprt->xp_socket->so_rcv);
+ if (cl != NULL)
+ CLNT_RELEASE(cl);
+
svc_vc_destroy_common(xprt);
if (cd->mreq)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 14, 5:50 PM (5 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15798599
Default Alt Text
D30153.diff (2 KB)
Attached To
Mode
D30153: acquire a reference count on the CLIENT structure for callbacks in the server krpc
Attached
Detach File
Event Timeline
Log In to Comment