From owner-svn-src-all@freebsd.org Fri Nov 13 22:51:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF740A2E309; Fri, 13 Nov 2015 22:51:37 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C797C1F85; Fri, 13 Nov 2015 22:51:37 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tADMpamW053832; Fri, 13 Nov 2015 22:51:36 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tADMpa8o053824; Fri, 13 Nov 2015 22:51:36 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201511132251.tADMpa8o053824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Fri, 13 Nov 2015 22:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290805 - in head: share/man/man9 sys/kern sys/net sys/netinet sys/netinet6 sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2015 22:51:38 -0000 Author: rrs Date: Fri Nov 13 22:51:35 2015 New Revision: 290805 URL: https://svnweb.freebsd.org/changeset/base/290805 Log: This fixes several places where callout_stops return is examined. The new return codes of -1 were mistakenly being considered "true". Callout_stop now returns -1 to indicate the callout had either already completed or was not running and 0 to indicate it could not be stopped. Also update the manual page to make it more consistent no non-zero in the callout_stop or callout_reset descriptions. MFC after: 1 Month with associated callout change. Modified: head/share/man/man9/timeout.9 head/sys/kern/subr_taskqueue.c head/sys/net/if_llatbl.c head/sys/netinet/in.c head/sys/netinet/tcp_timer.c head/sys/netinet6/in6.c head/sys/netinet6/nd6.c head/sys/netpfil/pf/if_pfsync.c Modified: head/share/man/man9/timeout.9 ============================================================================== --- head/share/man/man9/timeout.9 Fri Nov 13 22:33:51 2015 (r290804) +++ head/share/man/man9/timeout.9 Fri Nov 13 22:51:35 2015 (r290805) @@ -302,7 +302,7 @@ If .Fa c already has a pending callout, it is cancelled before the new invocation is scheduled. -These functions return a non-zero value if a pending callout was cancelled +These functions return a value of one if a pending callout was cancelled and zero if there was no pending callout. If the callout has an associated lock, then that lock must be held when any of these functions are called. @@ -804,16 +804,16 @@ The .Fn callout_reset and .Fn callout_schedule -function families return non-zero if the callout was pending before the new +function families return a value of one if the callout was pending before the new function invocation was scheduled. .Pp The .Fn callout_stop and .Fn callout_drain -functions return non-zero if the callout was still pending when it was -called or zero otherwise. -The +functions return a value of one if the callout was still pending when it was +called, a zero if the callout could not be stopped and a negative one is it +was either not running or haas already completed. The .Fn timeout function returns a .Ft struct callout_handle Modified: head/sys/kern/subr_taskqueue.c ============================================================================== --- head/sys/kern/subr_taskqueue.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/kern/subr_taskqueue.c Fri Nov 13 22:51:35 2015 (r290805) @@ -496,7 +496,7 @@ taskqueue_cancel_timeout(struct taskqueu int error; TQ_LOCK(queue); - pending = !!callout_stop(&timeout_task->c); + pending = !!(callout_stop(&timeout_task->c) > 0); error = taskqueue_cancel_locked(queue, &timeout_task->t, &pending1); if ((timeout_task->f & DT_CALLOUT_ARMED) != 0) { timeout_task->f &= ~DT_CALLOUT_ARMED; Modified: head/sys/net/if_llatbl.c ============================================================================== --- head/sys/net/if_llatbl.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/net/if_llatbl.c Fri Nov 13 22:51:35 2015 (r290805) @@ -394,7 +394,7 @@ lltable_free(struct lltable *llt) IF_AFDATA_WUNLOCK(llt->llt_ifp); LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) { - if (callout_stop(&lle->lle_timer)) + if (callout_stop(&lle->lle_timer) > 0) LLE_REMREF(lle); llentry_free(lle); } Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/netinet/in.c Fri Nov 13 22:51:35 2015 (r290805) @@ -1093,7 +1093,7 @@ in_lltable_free_entry(struct lltable *ll } /* cancel timer */ - if (callout_stop(&lle->lle_timer)) + if (callout_stop(&lle->lle_timer) > 0) LLE_REMREF(lle); /* Drop hold queue */ Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/netinet/tcp_timer.c Fri Nov 13 22:51:35 2015 (r290805) @@ -862,7 +862,7 @@ tcp_timer_activate(struct tcpcb *tp, uin } if (delta == 0) { if ((tp->t_timers->tt_flags & timer_type) && - callout_stop(t_callout) && + (callout_stop(t_callout) > 0) && (tp->t_timers->tt_flags & f_reset)) { tp->t_timers->tt_flags &= ~(timer_type | f_reset); } @@ -949,7 +949,7 @@ tcp_timer_stop(struct tcpcb *tp, uint32_ } if (tp->t_timers->tt_flags & timer_type) { - if (callout_stop(t_callout) && + if ((callout_stop(t_callout) > 0) && (tp->t_timers->tt_flags & f_reset)) { tp->t_timers->tt_flags &= ~(timer_type | f_reset); } else { Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/netinet6/in6.c Fri Nov 13 22:51:35 2015 (r290805) @@ -2133,7 +2133,7 @@ in6_lltable_free_entry(struct lltable *l lltable_unlink_entry(llt, lle); } - if (callout_stop(&lle->lle_timer)) + if (callout_stop(&lle->lle_timer) > 0) LLE_REMREF(lle); llentry_free(lle); Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/netinet6/nd6.c Fri Nov 13 22:51:35 2015 (r290805) @@ -508,7 +508,7 @@ nd6_llinfo_settimer_locked(struct llentr nd6_llinfo_timer, ln); } } - if (canceled) + if (canceled > 0) LLE_REMREF(ln); } Modified: head/sys/netpfil/pf/if_pfsync.c ============================================================================== --- head/sys/netpfil/pf/if_pfsync.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/netpfil/pf/if_pfsync.c Fri Nov 13 22:51:35 2015 (r290805) @@ -352,7 +352,7 @@ pfsync_clone_destroy(struct ifnet *ifp) TAILQ_REMOVE(&sc->sc_deferrals, pd, pd_entry); sc->sc_deferred--; - if (callout_stop(&pd->pd_tmo)) { + if (callout_stop(&pd->pd_tmo) > 0) { pf_release_state(pd->pd_st); m_freem(pd->pd_m); free(pd, M_PFSYNC); @@ -1775,7 +1775,7 @@ pfsync_undefer_state(struct pf_state *st TAILQ_FOREACH(pd, &sc->sc_deferrals, pd_entry) { if (pd->pd_st == st) { - if (callout_stop(&pd->pd_tmo)) + if (callout_stop(&pd->pd_tmo) > 0) pfsync_undefer(pd, drop); return; }