2025-03-04, 01:33:49 +0100, Antonio Quartulli wrote:
@@ -1317,11 +1336,16 @@ void ovpn_peer_keepalive_work(struct work_struct *work)
/* prevent rearming if the interface is being destroyed */
if (next_run > 0 && ovpn->registered) {
+ time64_t delta = next_run - now;
+
netdev_dbg(ovpn->dev,
"scheduling keepalive work: now=%llu next_run=%llu delta=%llu\n",
- next_run, now, next_run - now);
+ next_run, now, delta > 0 ? delta : 0);
+ /* due to the waiting above, the next_run deadline may have
+ * passed: in this case we reschedule the worker immediately
+ */
I don't understand this bit. I don't see what waiting you're refering
to (in particular within this patch), and I don't see how we could get
next_run < now based on how next_run is computed in
ovpn_peer_keepalive_work_single (next_run1/next_run2 is always set to
now + X or something that we just tested to be > now).
Am I missing something?
schedule_delayed_work(&ovpn->keepalive_work,
- (next_run - now) * HZ);
+ delta * HZ > 0 ? delta * HZ : 0);
}
unlock_ovpn(ovpn, &release_list);
}