summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCarl Baldwin <carl@ecbaldwin.net>2018-08-27 15:45:36 +0000
committerCarl Baldwin <carl@ecbaldwin.net>2018-08-27 18:06:03 +0000
commitacfc9ad7f9853ccd7b8a1c442f644e71434d5f9c (patch)
tree9a36feab2b19dc10336bec7d4100c5ee7d5afab8
parent008c961ecd943739c5db63fcd931904804a45aa5 (diff)
Release read lock before calling llgrFamilies
llgrFamilies gets a read lock itself but the caller already has one. Deadlock occurs when another goroutine is blocked on a write lock. Addresses #1818
-rw-r--r--pkg/server/peer.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/pkg/server/peer.go b/pkg/server/peer.go
index 1f67fd48..632e14a4 100644
--- a/pkg/server/peer.go
+++ b/pkg/server/peer.go
@@ -282,8 +282,9 @@ func (peer *Peer) llgrFamilies() ([]bgp.RouteFamily, []bgp.RouteFamily) {
func (peer *Peer) isLLGREnabledFamily(family bgp.RouteFamily) bool {
peer.fsm.lock.RLock()
- defer peer.fsm.lock.RUnlock()
- if !peer.fsm.pConf.GracefulRestart.Config.LongLivedEnabled {
+ llgrEnabled := peer.fsm.pConf.GracefulRestart.Config.LongLivedEnabled
+ peer.fsm.lock.RUnlock()
+ if !llgrEnabled {
return false
}
fs, _ := peer.llgrFamilies()