Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net wg: Switch to callout_stop for session destructor ti...



details:   https://anonhg.NetBSD.org/src/rev/ca9c92c9be16
branches:  trunk
changeset: 943351:ca9c92c9be16
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 31 20:26:21 2020 +0000

description:
wg: Switch to callout_stop for session destructor timer.

Can't release the lock here, and can't sleep waiting for the callout
while we hold it without risking deadlock.  But not waiting is fine;
after we transition out of WGS_STATE_UNKNOWN the timer has no effect.

diffstat:

 sys/net/if_wg.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r e3e120d5c148 -r ca9c92c9be16 sys/net/if_wg.c
--- a/sys/net/if_wg.c   Mon Aug 31 20:25:33 2020 +0000
+++ b/sys/net/if_wg.c   Mon Aug 31 20:26:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wg.c,v 1.41 2020/08/31 20:25:33 riastradh Exp $     */
+/*     $NetBSD: if_wg.c,v 1.42 2020/08/31 20:26:21 riastradh Exp $     */
 
 /*
  * Copyright (C) Ryota Ozaki <ozaki.ryota%gmail.com@localhost>
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.41 2020/08/31 20:25:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.42 2020/08/31 20:26:21 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1389,11 +1389,13 @@
        wgs = wg_lock_unstable_session(wgp);
        if (wgs->wgs_state == WGS_STATE_DESTROYING) {
                /*
-                * We can assume that the peer doesn't have an established
-                * session, so clear it now.
+                * We can assume that the peer doesn't have an
+                * established session, so clear it now.  If the timer
+                * fired, tough -- it won't have any effect unless we
+                * manage to transition back to WGS_STATE_DESTROYING.
                 */
                WG_TRACE("Session destroying, but force to clear");
-               callout_halt(&wgp->wgp_session_dtor_timer, NULL);
+               callout_stop(&wgp->wgp_session_dtor_timer);
                wg_clear_states(wgs);
                wgs->wgs_state = WGS_STATE_UNKNOWN;
        }



Home | Main Index | Thread Index | Old Index