session: make sure fifos are freed on right thread 21/36321/3
authorFlorin Coras <fcoras@cisco.com>
Wed, 1 Jun 2022 21:44:11 +0000 (14:44 -0700)
committerFlorin Coras <fcoras@cisco.com>
Wed, 1 Jun 2022 21:56:15 +0000 (14:56 -0700)
Type: improvement

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I3c573641bd95fe899823b66f6c59a2525a18d293

src/vnet/session/segment_manager.c

index e72e833..14e4e21 100644 (file)
@@ -856,6 +856,10 @@ segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo, svm_fifo_t * tx_fifo)
   if (!rx_fifo || !tx_fifo)
     return;
 
+  /* Thread that allocated the fifos must be the one to clean them up */
+  ASSERT (rx_fifo->master_thread_index == vlib_get_thread_index () ||
+         rx_fifo->refcnt > 1);
+
   /* It's possible to have no segment manager if the session was removed
    * as result of a detach. */
   if (!(sm = segment_manager_get_if_valid (rx_fifo->segment_manager)))