NetBSD-Bugs archive

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

Re: kern/45634: hardclock_ticks corner cases in vflushnext() et al



The following reply was made to PR kern/45634; it has been noted by GNATS.

From: Christian Biere <christianbiere%gmx.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/45634: hardclock_ticks corner cases in vflushnext() et al
Date: Wed, 23 Nov 2011 22:54:19 +0100

 On Wed, 23 Nov 2011 20:55:02 +0000 (UTC)
 christos%zoulas.com@localhost (Christos Zoulas) wrote:
 
 >  On Nov 23,  7:55pm, christianbiere%gmx.de@localhost (Christian Biere) wrote:
 >  -- Subject: Re: kern/45634: hardclock_ticks corner cases in vflushnext() et 
 > a
 >  
 >  |  @@ -436,7 +437,7 @@
 >  |   vflush(struct mount *mp, vnode_t *skipvp, int flags)
 >  |   {
 >  |           vnode_t *vp, *mvp;
 >  |  -        int busy = 0, when = 0;
 >  |  +        unsigned busy = 0, dly = 10 / hz, when = hardclock_ticks - dly 
 > - 1;
 >  |   
 >  
 >  Did you mean to delete the declaration of when?
 
 Not exactly. For clarity it could also splitted:
 
 unsigned busy, dly, when;
 
 busy = 0;
 dly = 10 / hz;
 when = hardclock_ticks - dly - 1;
 
 Note that "when" must be properly initialized and not just be set to zero.
 Consider "hardclock_ticks" being negative. If "when" was zero, a lot of
 ticks would pass before "dt > dly" evaluates true. The same applies to
 the current code with respect to "hardclock_ticks > *when", which I think
 is a bug, too.
 
 -- 
 Christian Biere
 


Home | Main Index | Thread Index | Old Index