NetBSD-Bugs archive

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

Re: kern/60621 (panic: ufs_inactive: dirty filesystem?)



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

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: Taylor R Campbell <riastradh%NetBSD.org@localhost>
Cc: "J. Hannken-Illjes" <hannken%NetBSD.org@localhost>, gnats-bugs%NetBSD.org@localhost,
        netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/60621 (panic: ufs_inactive: dirty filesystem?)
Date: Thu, 19 Nov 2026 22:03:46 +0700

     Date:        Thu, 19 Nov 2026 00:27:54 +0000
     From:        Taylor R Campbell <riastradh%NetBSD.org@localhost>
     Message-ID:  <20261119002756.41C2F84EB1%mail.netbsd.org@localhost>
 
   | 3. Would like to make sure the multiplications don't overflow, by
   |    asserting (and otherwise enforcing) bounds on wl_bufbytes_max,
   |    wl_bufcount_max, wl_circ_size, and wl_dealloclim < SIZE_MAX/3.
 
 I'm not qualified to comment on the rest of this, but for this part,
 since the 75% is just number plucked from the air, approximately where
 it would be good to reach, and not something that needs to be precisely
 computed, an easier way to deal with that problem is to just write them as:
 
 	wl->wl_bufbytes_max / 4 * 3
 
 (etc).   If there's any possibility that any of the values might
 be < 4, leading to a 0 from the division, and so a 0 result, which
 wouldn't happen with the multiplication first, it could be written as
 
 	(wl->wl_bufbytes_max | 4) / 4 * 3
 
 The "|4" (not +3 to ensure no overflow results) would make sure there's
 no possibility of a zero result from the division, without making any
 real difference when wl_bufbytes_max is a more sensible big number.
 
 It would be hide this expr in a macro though (or even a static inline func),
 rather than writing it over and over again for all the different values.
 
 kre
 



Home | Main Index | Thread Index | Old Index