Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Oct 2008 11:37:43 +0000 (UTC)
From:      David Xu <davidxu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r184259 - in stable/7/sys: . kern
Message-ID:  <200810251137.m9PBbhnI031411@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: davidxu
Date: Sat Oct 25 11:37:42 2008
New Revision: 184259
URL: http://svn.freebsd.org/changeset/base/184259

Log:
  Merge revision 184067 from head to stable/7:
  
  	In realtimer_delete(), clear timer's value and interval to tell
  	realtimer_expire() to not rearm the timer, otherwise there is a
  	chance that a callout will be left there and be tiggered in future
  	unexpectly.
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/kern/kern_time.c

Modified: stable/7/sys/kern/kern_time.c
==============================================================================
--- stable/7/sys/kern/kern_time.c	Sat Oct 25 10:55:49 2008	(r184258)
+++ stable/7/sys/kern/kern_time.c	Sat Oct 25 11:37:42 2008	(r184259)
@@ -1225,6 +1225,12 @@ realtimer_delete(struct itimer *it)
 {
 	mtx_assert(&it->it_mtx, MA_OWNED);
 	
+	/*
+	 * clear timer's value and interval to tell realtimer_expire
+	 * to not rearm the timer.
+	 */
+	timespecclear(&it->it_time.it_value);
+	timespecclear(&it->it_time.it_interval);
 	ITIMER_UNLOCK(it);
 	callout_drain(&it->it_callout);
 	ITIMER_LOCK(it);
@@ -1374,9 +1380,11 @@ realtimer_expire(void *arg)
 			callout_reset(&it->it_callout, tvtohz(&tv),
 				 realtimer_expire, it);
 		}
+		itimer_enter(it);
 		ITIMER_UNLOCK(it);
 		itimer_fire(it);
 		ITIMER_LOCK(it);
+		itimer_leave(it);
 	} else if (timespecisset(&it->it_time.it_value)) {
 		ts = it->it_time.it_value;
 		timespecsub(&ts, &cts);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810251137.m9PBbhnI031411>