Re: [PATCH net] bridge: fix hello and hold timers starting/stopping
From: Xin Long <lucien.xin@gmail.com>
Date: 2017-05-19 17:26:35
Also in:
bridge
On Sat, May 20, 2017 at 12:25 AM, Ivan Vecera [off-list ref] wrote: [...]
quoted hunk ↗ jump to hunk
@@ -197,13 +191,14 @@ static void br_stp_stop(struct net_bridge *br) br_err(br, "failed to stop userspace STP (%d)\n", err); /* To start timers on any ports left in blocking */ - mod_timer(&br->hello_timer, jiffies + br->hello_time); - list_for_each_entry(p, &br->port_list, list) - mod_timer(&p->hold_timer, - round_jiffies(jiffies + BR_HOLD_TIME)); spin_lock_bh(&br->lock); br_port_state_selection(br); spin_unlock_bh(&br->lock); + } else { + /* BR_KERNEL_STP - stop hello and hold timers */ + del_timer(&br->hello_timer); + list_for_each_entry(p, &br->port_list, list) + del_timer(&p->hold_timer); } br->stp_enabled = BR_NO_STP;
I have a question here, br->stp_enabled is not atomic, and it is being changed without holding br->lock here, while it may be checked in br_hello_timer_expired, is it safe ? (sorry if I misunderstood or overthought about it)
-- 2.13.0