Source-Changes-HG archive

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

[src/trunk]: src/sys Re-add callout_active(), in a way compatible with the Fr...



details:   https://anonhg.NetBSD.org/src/rev/1b760a2c9f57
branches:  trunk
changeset: 574540:1b760a2c9f57
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri Mar 04 05:51:41 2005 +0000

description:
Re-add callout_active(), in a way compatible with the FreeBSD version, and use
it in the TCP stack to test which of the REXMT or PERSIST timer is in use.
This fixes a race condition that could cause "panic: tcp_output REXMT".  See
tech-net for details.

diffstat:

 sys/netinet/tcp_timer.h |  8 +++++---
 sys/sys/callout.h       |  3 ++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r c94ff6aadf86 -r 1b760a2c9f57 sys/netinet/tcp_timer.h
--- a/sys/netinet/tcp_timer.h   Fri Mar 04 05:22:52 2005 +0000
+++ b/sys/netinet/tcp_timer.h   Fri Mar 04 05:51:41 2005 +0000
@@ -1,11 +1,13 @@
-/*     $NetBSD: tcp_timer.h,v 1.20 2003/08/07 16:33:19 agc Exp $       */
+/*     $NetBSD: tcp_timer.h,v 1.21 2005/03/04 05:51:41 mycroft Exp $   */
 
 /*-
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * Copyright (c) 2001, 2005 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Jason R. Thorpe of Wasabi Systems, Inc.
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -162,7 +164,7 @@
        callout_stop(&(tp)->t_timer[(timer)])
 
 #define        TCP_TIMER_ISARMED(tp, timer)                                    \
-       callout_pending(&(tp)->t_timer[(timer)])
+       callout_active(&(tp)->t_timer[(timer)])
 
 /*
  * Force a time value to be in a certain range.
diff -r c94ff6aadf86 -r 1b760a2c9f57 sys/sys/callout.h
--- a/sys/sys/callout.h Fri Mar 04 05:22:52 2005 +0000
+++ b/sys/sys/callout.h Fri Mar 04 05:51:41 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: callout.h,v 1.20 2003/10/30 04:32:56 thorpej Exp $     */
+/*     $NetBSD: callout.h,v 1.21 2005/03/04 05:51:41 mycroft Exp $     */
 
 /*-
  * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -123,6 +123,7 @@
 
 #define        callout_pending(c)      ((c)->c_flags & CALLOUT_PENDING)
 #define        callout_expired(c)      ((c)->c_flags & CALLOUT_FIRED)
+#define        callout_active(c)       ((c)->c_flags & (CALLOUT_PENDING|CALLOUT_FIRED))
 #define        callout_invoking(c)     ((c)->c_flags & CALLOUT_INVOKING)
 #define        callout_ack(c)          ((c)->c_flags &= ~CALLOUT_INVOKING)
 #endif /* _KERNEL */



Home | Main Index | Thread Index | Old Index