Skip to content

Commit

Permalink
Increment Nexthop ref count atomically
Browse files Browse the repository at this point in the history
Right now, the NH's refcount is not incremented atomically as reference
to NH is always taken from a single thread in nelink context. This is
becuase Routes, Labels, and other NH's access an NH only when Agent
performs config changes. But with data path mac learning in place
because of PBB, reference to NH, esp L2 Mutlicast NH, happens from
multiple threads leading to requirement incrementing it atomically. Not
doing it causes the ref count to go bad for that particular NH and
results in double free of NH.

Change-Id: I0afa517b56eeac0371670ee76241e392be762f20
closes-bug: #1672293
closes-bug: #1672373
closes-bug: #1673663
  • Loading branch information
divakardhar committed Apr 10, 2017
1 parent ce0920a commit d0eeccc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dp-core/vr_nexthop.c
Expand Up @@ -52,7 +52,7 @@ vrouter_get_nexthop(unsigned int rid, unsigned int index)
router = vrouter_get(rid);
nh = __vrouter_get_nexthop(router, index);
if (nh)
nh->nh_users++;
(void)__sync_add_and_fetch(&nh->nh_users, 1);

return nh;
}
Expand Down

0 comments on commit d0eeccc

Please sign in to comment.