git: a0618fbe19df - main - Revert "ipfilter: Avoid stopping with a lock held"

From: Jose Luis Duran <jlduran_at_FreeBSD.org>
Date: Tue, 12 Nov 2024 18:57:39 UTC
The branch main has been updated by jlduran:

URL: https://cgit.FreeBSD.org/src/commit/?id=a0618fbe19dfedcdf01b4c232fe6669ae19505c4

commit a0618fbe19dfedcdf01b4c232fe6669ae19505c4
Author:     Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-12 18:51:45 +0000
Commit:     Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-11-12 18:53:39 +0000

    Revert "ipfilter: Avoid stopping with a lock held"
    
    The timeout function still tries to acquire the rwlock, and now it
    deadlocks, since the callout framework will have already acquired it.
    
    This reverts commit 1fa6daaafd74c1a457dcfe26e0a5943b5441dc9d.
    
    PR:             282478
    Reported by:    markj
    Approved by:    emaste (mentor)
---
 sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c
index 23514907f86e..84fac0205ffc 100644
--- a/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c
+++ b/sys/netpfil/ipfilter/netinet/ip_fil_freebsd.c
@@ -178,7 +178,7 @@ ipf_timer_func(void *arg)
 		ipf_slowtimer(softc);
 
 	if (softc->ipf_running == -1 || softc->ipf_running == 1) {
-		callout_init_rw(&softc->ipf_slow_ch, &softc->ipf_global.ipf_lk, CALLOUT_SHAREDLOCK);
+		callout_init(&softc->ipf_slow_ch, 1);
 		callout_reset(&softc->ipf_slow_ch,
 			(hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT,
 			ipf_timer_func, softc);
@@ -218,7 +218,7 @@ ipfattach(ipf_main_softc_t *softc)
 	softc->ipf_slow_ch = timeout(ipf_timer_func, softc,
 				     (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT);
 #endif
-	callout_init_rw(&softc->ipf_slow_ch, &softc->ipf_global.ipf_lk, CALLOUT_SHAREDLOCK);
+	callout_init(&softc->ipf_slow_ch, 1);
 	callout_reset(&softc->ipf_slow_ch, (hz / IPF_HZ_DIVIDE) * IPF_HZ_MULT,
 		ipf_timer_func, softc);
 	return (0);