]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #13649 from donaldsharp/unlock_the_node_or_else master
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 6 Jun 2023 05:52:40 +0000 (08:52 +0300)
committerGitHub <noreply@github.com>
Tue, 6 Jun 2023 05:52:40 +0000 (08:52 +0300)
zebra: Unlock the route node when sending route notifications

zebra/rib.h
zebra/zapi_msg.c

index a56bb05d684ef3731ce7e43788cc99d6c01745ea..65cc1ffab91442bdf48959a8777b9daf11c9dcb9 100644 (file)
@@ -465,6 +465,13 @@ extern uint8_t route_distance(int type);
 extern void zebra_rib_evaluate_rn_nexthops(struct route_node *rn, uint32_t seq,
                                           bool rt_delete);
 
+/*
+ * rib_find_rn_from_ctx
+ *
+ * Returns a lock increased route_node for the appropriate
+ * table and prefix specified by the context.  Developer
+ * should unlock the node when done.
+ */
 extern struct route_node *
 rib_find_rn_from_ctx(const struct zebra_dplane_ctx *ctx);
 
index 4c6c336d417e11b44f324499f19923b3e4929584..4bc9f4acfa84a2d0f9f25bd06d02f92a86d2cfe4 100644 (file)
@@ -801,11 +801,17 @@ int zsend_route_notify_owner(const struct route_node *rn,
 int zsend_route_notify_owner_ctx(const struct zebra_dplane_ctx *ctx,
                                 enum zapi_route_notify_owner note)
 {
-       return (route_notify_internal(
-               rib_find_rn_from_ctx(ctx), dplane_ctx_get_type(ctx),
-               dplane_ctx_get_instance(ctx), dplane_ctx_get_vrf(ctx),
-               dplane_ctx_get_table(ctx), note, dplane_ctx_get_afi(ctx),
-               dplane_ctx_get_safi(ctx)));
+       int result;
+       struct route_node *rn = rib_find_rn_from_ctx(ctx);
+
+       result = route_notify_internal(
+               rn, dplane_ctx_get_type(ctx), dplane_ctx_get_instance(ctx),
+               dplane_ctx_get_vrf(ctx), dplane_ctx_get_table(ctx), note,
+               dplane_ctx_get_afi(ctx), dplane_ctx_get_safi(ctx));
+
+       route_unlock_node(rn);
+
+       return result;
 }
 
 static void zread_route_notify_request(ZAPI_HANDLER_ARGS)