> Date: Tue, 11 Apr 2023 21:50:49 +0200 > From: Michael van Elst <mlel...@serpens.de> > > On Wed, Apr 12, 2023 at 01:10:40AM +0700, Robert Elz wrote: > > > > | In that state then decrementing dk_rawopens beyond zero will make > > | dklastclose do the right thing: nothing. > > > > Except that if that happens, dk_rawopens will be left == ~0 and the next > > open attempt will then increment it, back to 0 again, which is almost > > certainly not what was wanted. > > > > dklastclose() used to have code in it like > > > > if (...->dk_rawopens > 0) { > > if (--...->dk_rawopens == 0) > > > Indeed, that part was simplified away.
Correct. I first added the assertion dk_rawopens > 0 in the following change change because, as I wrote in the commit message: It is not possible for us to be closing a wedge whose parent is not open by at least this wedge. https://mail-index.netbsd.org/source-changes-hg/2022/08/22/msg359438.html See https://mail-index.netbsd.org/source-changes-d/2023/04/11/msg013937.html for more details of why I believe the condition is always true here. Then, on the grounds that the condition is always true (and asserted to be so), I removed the conditional in a separate change: https://mail-index.netbsd.org/source-changes-hg/2022/08/22/msg359439.html So if you actually hit the assertion, please share diagnostics, or if you believe there is a way that you could hit the assertion, please explain how and we can figure out how to address it. But if not, please put the assertions back, or I will next week.