Merge pull request #12732 from donaldsharp/fix_bgp_open_issues

bgpd: Don't try to recursively hold peer io mutex
This commit is contained in:
Mark Stapp 2023-02-03 07:17:00 -05:00 committed by GitHub
commit 9d5c511864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -173,12 +173,11 @@ static int read_ibuf_work(struct peer *peer)
uint16_t pktsize = 0;
struct stream *pkt;
/* Hold the I/O lock, we might not have space on the InQ */
frr_mutex_lock_autounlock(&peer->io_mtx);
/* ============================================== */
if (peer->ibuf->count >= bm->inq_limit)
return -ENOMEM;
frr_with_mutex (&peer->io_mtx) {
if (peer->ibuf->count >= bm->inq_limit)
return -ENOMEM;
}
/* check that we have enough data for a header */
if (ringbuf_remain(ibw) < BGP_HEADER_SIZE)
@ -211,7 +210,9 @@ static int read_ibuf_work(struct peer *peer)
stream_set_endp(pkt, pktsize);
frrtrace(2, frr_bgp, packet_read, peer, pkt);
stream_fifo_push(peer->ibuf, pkt);
frr_with_mutex (&peer->io_mtx) {
stream_fifo_push(peer->ibuf, pkt);
}
return pktsize;
}