Fix lock leak in purely hypothetical case of TCP connection without SVC_ACK
method. This change should be NOP now, but it is better to be future safe. Reported by: rmacklem
This commit is contained in:
parent
fa7f47e2d5
commit
f63cb2f402
@ -220,7 +220,7 @@ void nfsrvd_dorpc(struct nfsrv_descript *, int, NFSPROC_T *);
|
||||
void nfsrvd_initcache(void);
|
||||
int nfsrvd_getcache(struct nfsrv_descript *);
|
||||
struct nfsrvcache *nfsrvd_updatecache(struct nfsrv_descript *);
|
||||
void nfsrvd_sentcache(struct nfsrvcache *, uint32_t);
|
||||
void nfsrvd_sentcache(struct nfsrvcache *, int, uint32_t);
|
||||
void nfsrvd_cleancache(void);
|
||||
void nfsrvd_refcache(struct nfsrvcache *);
|
||||
void nfsrvd_derefcache(struct nfsrvcache *);
|
||||
|
@ -576,18 +576,20 @@ nfsrvd_delcache(struct nfsrvcache *rp)
|
||||
* the pointer returned by nfsrvd_updatecache().
|
||||
*/
|
||||
APPLESTATIC void
|
||||
nfsrvd_sentcache(struct nfsrvcache *rp, uint32_t seq)
|
||||
nfsrvd_sentcache(struct nfsrvcache *rp, int have_seq, uint32_t seq)
|
||||
{
|
||||
struct nfsrchash_bucket *hbp;
|
||||
|
||||
KASSERT(rp->rc_flag & RC_LOCKED, ("nfsrvd_sentcache not locked"));
|
||||
hbp = NFSRCAHASH(rp->rc_sockref);
|
||||
mtx_lock(&hbp->mtx);
|
||||
rp->rc_tcpseq = seq;
|
||||
if (rp->rc_acked != RC_NO_ACK)
|
||||
LIST_INSERT_HEAD(&hbp->tbl, rp, rc_ahash);
|
||||
rp->rc_acked = RC_NO_ACK;
|
||||
mtx_unlock(&hbp->mtx);
|
||||
if (have_seq) {
|
||||
hbp = NFSRCAHASH(rp->rc_sockref);
|
||||
mtx_lock(&hbp->mtx);
|
||||
rp->rc_tcpseq = seq;
|
||||
if (rp->rc_acked != RC_NO_ACK)
|
||||
LIST_INSERT_HEAD(&hbp->tbl, rp, rc_ahash);
|
||||
rp->rc_acked = RC_NO_ACK;
|
||||
mtx_unlock(&hbp->mtx);
|
||||
}
|
||||
nfsrc_unlock(rp);
|
||||
}
|
||||
|
||||
|
@ -287,8 +287,8 @@ nfssvc_program(struct svc_req *rqst, SVCXPRT *xprt)
|
||||
svcerr_systemerr(rqst);
|
||||
}
|
||||
if (rp != NULL) {
|
||||
if (rqst->rq_reply_seq != 0 || SVC_ACK(xprt, NULL))
|
||||
nfsrvd_sentcache(rp, rqst->rq_reply_seq);
|
||||
nfsrvd_sentcache(rp, (rqst->rq_reply_seq != 0 ||
|
||||
SVC_ACK(xprt, NULL)), rqst->rq_reply_seq);
|
||||
}
|
||||
svc_freereq(rqst);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user