]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
batman-adv: convert cancellation of work items to disable helper
authorSven Eckelmann <sven@narfation.org>
Tue, 26 May 2026 07:09:32 +0000 (09:09 +0200)
committerSven Eckelmann <sven@narfation.org>
Fri, 5 Jun 2026 07:12:06 +0000 (09:12 +0200)
With commit 86898fa6b8cd ("workqueue: Implement disable/enable for
(delayed) work items"), work queues gained the ability to permanently
disallow re-queuing of work items. This is particularly important during
object teardown, where a work item must not be re-armed after shutdown
begins.

Convert all cancel_work_sync() and cancel_delayed_work_sync() call sites to
their disable_* equivalents to clarify the intent to prevent re-arming
after teardown.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bat_v.c
net/batman-adv/bat_v_elp.c
net/batman-adv/bat_v_ogm.c
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/distributed-arp-table.c
net/batman-adv/multicast.c
net/batman-adv/originator.c
net/batman-adv/send.c
net/batman-adv/tp_meter.c
net/batman-adv/translation-table.c

index 6f5a468c4084c23f191e164d685f01162f662ce9..7588e64e7ba6f4f5bea437c0c6223294d3a9bd38 100644 (file)
@@ -230,7 +230,7 @@ static void batadv_iv_ogm_iface_disable(struct batadv_hard_iface *hard_iface)
 
        mutex_unlock(&hard_iface->bat_iv.ogm_buff_mutex);
 
-       cancel_delayed_work_sync(&hard_iface->bat_iv.reschedule_work);
+       disable_delayed_work_sync(&hard_iface->bat_iv.reschedule_work);
 }
 
 static void batadv_iv_ogm_iface_update_mac(struct batadv_hard_iface *hard_iface)
index ac2932da5472d3b04c16f1b2cef657466dd3ed36..cb081038d14f51d17cab6cbc2cb617356923ae32 100644 (file)
@@ -819,6 +819,8 @@ void batadv_v_hardif_init(struct batadv_hard_iface *hard_iface)
        skb_queue_head_init(&hard_iface->bat_v.aggr_list);
        INIT_DELAYED_WORK(&hard_iface->bat_v.aggr_wq,
                          batadv_v_ogm_aggr_work);
+       /* make sure it doesn't run until interface gets enabled */
+       disable_delayed_work(&hard_iface->bat_v.aggr_wq);
 }
 
 /**
index d53485d17220e68627909a1d9f6f8e69bdf67e4e..4841f0f1a9b1391c9fd4887b267a4da28a87e678 100644 (file)
@@ -115,7 +115,7 @@ static bool batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh,
                        goto default_throughput;
 
                /* only use rtnl_trylock because the elp worker will be cancelled while
-                * the rntl_lock is held. the cancel_delayed_work_sync() would otherwise
+                * the rntl_lock is held. the disable_delayed_work_sync() would otherwise
                 * wait forever when the elp work_item was started and it is then also
                 * trying to rtnl_lock
                 */
@@ -162,7 +162,7 @@ static bool batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh,
        }
 
        /* only use rtnl_trylock because the elp worker will be cancelled while
-        * the rntl_lock is held. the cancel_delayed_work_sync() would otherwise
+        * the rntl_lock is held. the disable_delayed_work_sync() would otherwise
         * wait forever when the elp work_item was started and it is then also
         * trying to rtnl_lock
         */
@@ -447,7 +447,7 @@ out:
  */
 void batadv_v_elp_iface_disable(struct batadv_hard_iface *hard_iface)
 {
-       cancel_delayed_work_sync(&hard_iface->bat_v.elp_wq);
+       disable_delayed_work_sync(&hard_iface->bat_v.elp_wq);
 
        dev_kfree_skb(hard_iface->bat_v.elp_skb);
        hard_iface->bat_v.elp_skb = NULL;
index 5936d0048be019e4b74d4e736a4cc57f92271e30..72ae8ffc9db654fe721ece50cd498139db0931fe 100644 (file)
@@ -415,6 +415,8 @@ int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface)
 {
        struct batadv_priv *bat_priv = netdev_priv(hard_iface->mesh_iface);
 
+       enable_delayed_work(&hard_iface->bat_v.aggr_wq);
+
        batadv_v_ogm_start_queue_timer(hard_iface);
        batadv_v_ogm_start_timer(bat_priv);
 
@@ -427,7 +429,7 @@ int batadv_v_ogm_iface_enable(struct batadv_hard_iface *hard_iface)
  */
 void batadv_v_ogm_iface_disable(struct batadv_hard_iface *hard_iface)
 {
-       cancel_delayed_work_sync(&hard_iface->bat_v.aggr_wq);
+       disable_delayed_work_sync(&hard_iface->bat_v.aggr_wq);
 
        spin_lock_bh(&hard_iface->bat_v.aggr_list.lock);
        batadv_v_ogm_aggr_list_free(hard_iface);
@@ -1080,7 +1082,7 @@ int batadv_v_ogm_init(struct batadv_priv *bat_priv)
  */
 void batadv_v_ogm_free(struct batadv_priv *bat_priv)
 {
-       cancel_delayed_work_sync(&bat_priv->bat_v.ogm_wq);
+       disable_delayed_work_sync(&bat_priv->bat_v.ogm_wq);
 
        mutex_lock(&bat_priv->bat_v.ogm_buff_mutex);
 
index 0461f11227d06b50802b8d30a4809d615a4b9ca4..0bd24a19ff20225130508f3b8545303c829788ba 100644 (file)
@@ -1282,7 +1282,7 @@ purge_now:
 
                        if (purged) {
                                /* reference for pending report_work */
-                               if (cancel_work_sync(&backbone_gw->report_work))
+                               if (disable_work_sync(&backbone_gw->report_work))
                                        batadv_backbone_gw_put(backbone_gw);
 
                                /* reference for hash_entry */
@@ -1850,7 +1850,7 @@ void batadv_bla_free(struct batadv_priv *bat_priv)
 {
        struct batadv_hard_iface *primary_if;
 
-       cancel_delayed_work_sync(&bat_priv->bla.work);
+       disable_delayed_work_sync(&bat_priv->bla.work);
        primary_if = batadv_primary_if_get_selected(bat_priv);
 
        if (bat_priv->bla.claim_hash) {
index 0b02018c5b8501fd754fdd539c7d8c2c261cc146..aaea155b9403828c441befc8ad3cee29b2147409 100644 (file)
@@ -838,7 +838,7 @@ void batadv_dat_free(struct batadv_priv *bat_priv)
        batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_DAT, 1);
        batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_DAT, 1);
 
-       cancel_delayed_work_sync(&bat_priv->dat.work);
+       disable_delayed_work_sync(&bat_priv->dat.work);
 
        batadv_dat_hash_free(bat_priv);
 }
index 3274e2ac4f4a73e2211162f94f1b88bb6d226d06..1c5315e55c046f7c5a2ada2dfe61daf3080e0bc2 100644 (file)
@@ -2161,7 +2161,7 @@ int batadv_mcast_flags_dump(struct sk_buff *msg, struct netlink_callback *cb)
  */
 void batadv_mcast_free(struct batadv_priv *bat_priv)
 {
-       cancel_delayed_work_sync(&bat_priv->mcast.work);
+       disable_delayed_work_sync(&bat_priv->mcast.work);
 
        batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2);
        batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST_TRACKER, 1);
index 15d660ca793765e4dc49b40c882be2da2056f2a2..b161232c10885d85c31e9f960c9844dbdfc09a4b 100644 (file)
@@ -908,7 +908,7 @@ void batadv_originator_free(struct batadv_priv *bat_priv)
        if (!hash)
                return;
 
-       cancel_delayed_work_sync(&bat_priv->orig_work);
+       disable_delayed_work_sync(&bat_priv->orig_work);
 
        bat_priv->orig_hash = NULL;
 
index 5f9da3606a8f572c82666ec60fbe6b6031e0d6dd..7f449338a4909ff0d98e2375ca2b08b38cde7fdd 100644 (file)
@@ -629,7 +629,7 @@ static void batadv_forw_packet_list_free(struct hlist_head *head)
 
        hlist_for_each_entry_safe(forw_packet, safe_tmp_node, head,
                                  cleanup_list) {
-               cancel_delayed_work_sync(&forw_packet->delayed_work);
+               disable_delayed_work_sync(&forw_packet->delayed_work);
 
                hlist_del(&forw_packet->cleanup_list);
                batadv_forw_packet_free(forw_packet, true);
index cc72468ca2abed3393620a980f7ae6099d16c122..a404d70e053e23da4d97549047e478a9ef410f56 100644 (file)
@@ -421,7 +421,7 @@ static bool batadv_tp_list_detach(struct batadv_tp_vars_common *tp_vars)
  */
 static void batadv_tp_sender_cleanup(struct batadv_tp_sender *tp_vars)
 {
-       cancel_delayed_work_sync(&tp_vars->finish_work);
+       disable_delayed_work_sync(&tp_vars->finish_work);
 
        if (batadv_tp_list_detach(&tp_vars->common))
                batadv_tp_sender_put(tp_vars);
index c346e43d47b9b5887de545c7c1c095a20bdaa4fc..8b6c49c32c89270b17376fe578fca31310e6b327 100644 (file)
@@ -3574,7 +3574,7 @@ void batadv_tt_free(struct batadv_priv *bat_priv)
        batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_TT, 1);
        batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_TT, 1);
 
-       cancel_delayed_work_sync(&bat_priv->tt.work);
+       disable_delayed_work_sync(&bat_priv->tt.work);
 
        batadv_tt_local_table_free(bat_priv);
        batadv_tt_global_table_free(bat_priv);