From owner-svn-src-all@FreeBSD.ORG Mon Oct 20 02:37:54 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BAE6106566C; Mon, 20 Oct 2008 02:37:54 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A1E68FC1E; Mon, 20 Oct 2008 02:37:54 +0000 (UTC) (envelope-from davidxu@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9K2brsN058087; Mon, 20 Oct 2008 02:37:53 GMT (envelope-from davidxu@svn.freebsd.org) Received: (from davidxu@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9K2brwF058086; Mon, 20 Oct 2008 02:37:53 GMT (envelope-from davidxu@svn.freebsd.org) Message-Id: <200810200237.m9K2brwF058086@svn.freebsd.org> From: David Xu Date: Mon, 20 Oct 2008 02:37:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184067 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Mon, 20 Oct 2008 02:37:54 -0000 Author: davidxu Date: Mon Oct 20 02:37:53 2008 New Revision: 184067 URL: http://svn.freebsd.org/changeset/base/184067 Log: 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. Bug reported by: tegge@ Modified: head/sys/kern/kern_time.c Modified: head/sys/kern/kern_time.c ============================================================================== --- head/sys/kern/kern_time.c Mon Oct 20 01:46:54 2008 (r184066) +++ head/sys/kern/kern_time.c Mon Oct 20 02:37:53 2008 (r184067) @@ -1242,6 +1242,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); @@ -1391,9 +1397,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);