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>
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)
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);
}
/**
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
*/
}
/* 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
*/
*/
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;
{
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);
*/
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);
*/
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);
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 */
{
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) {
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);
}
*/
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);
if (!hash)
return;
- cancel_delayed_work_sync(&bat_priv->orig_work);
+ disable_delayed_work_sync(&bat_priv->orig_work);
bat_priv->orig_hash = NULL;
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);
*/
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);
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);