]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: during shutdown processing, drop dplane results
authorMark Stapp <mjs@voltanet.io>
Fri, 27 Sep 2019 16:15:34 +0000 (12:15 -0400)
committerMark Stapp <mjs@voltanet.io>
Fri, 27 Sep 2019 16:15:34 +0000 (12:15 -0400)
Don't process dataplane results in zebra during shutdown (after
sigint has been seen). The dplane continues to run in order to
clean up, but zebra main just drops results.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
zebra/main.c
zebra/zebra_rib.c
zebra/zebra_router.h

index 99607c0d78a72b7a4a9f5b3b928d187e42c9f326..f0225ac5e6b63797a43f4316ca178ec77dcf8fe7 100644 (file)
@@ -142,6 +142,9 @@ static void sigint(void)
 
        zlog_notice("Terminating on signal");
 
+       atomic_store_explicit(&zrouter.in_shutdown, true,
+                             memory_order_relaxed);
+
        frr_early_fini();
 
        zebra_dplane_pre_finish();
index 98e66cd01791f5831bfa74691c02687f3c285d9a..fef54d5828a45363c34124a094812af6df708e69 100644 (file)
@@ -3204,6 +3204,7 @@ static int rib_process_dplane_results(struct thread *thread)
 {
        struct zebra_dplane_ctx *ctx;
        struct dplane_ctx_q ctxlist;
+       bool shut_p = false;
 
        /* Dequeue a list of completed updates with one lock/unlock cycle */
 
@@ -3223,6 +3224,21 @@ static int rib_process_dplane_results(struct thread *thread)
                if (ctx == NULL)
                        break;
 
+               /* If zebra is shutting down, avoid processing results,
+                * just drain the results queue.
+                */
+               shut_p = atomic_load_explicit(&zrouter.in_shutdown,
+                                             memory_order_relaxed);
+               if (shut_p) {
+                       while (ctx) {
+                               dplane_ctx_fini(&ctx);
+
+                               ctx = dplane_ctx_dequeue(&ctxlist);
+                       }
+
+                       continue;
+               }
+
                while (ctx) {
                        switch (dplane_ctx_get_op(ctx)) {
                        case DPLANE_OP_ROUTE_INSTALL:
index e50f8a1186f2dab5150c2f8e264b9aad2f1b40d8..25a7adac11f7262a8904de5f0029fc0d4a873906 100644 (file)
@@ -74,6 +74,8 @@ struct zebra_mlag_info {
 };
 
 struct zebra_router {
+       atomic_bool in_shutdown;
+
        /* Thread master */
        struct thread_master *master;