On Tue, May 07, 2019 at 12:23:23PM -0700, Linus Torvalds wrote: > On Tue, May 7, 2019 at 12:16 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > > > Negative ->d_lockref.count are used for "lockref is dead"... > > We can change that to just -1, can't we? It's equally easy to test for. Provided that lockref.c is updated accordingly (look at e.g. lockref_get_not_zero()). > Those aren't supposed to be incremented anyway, which is the whole point. > > But we could do what the page refs also did: consider refcounts in the > "small negative range" to be very special, because they are either > critically close to an overflow, or they are actually a sign of a > fatal underflow due to some bug. And make one of those be the dead > marker. lockref_get_not_zero() hitting dead dentry is not abnormal, so we'd better not complain in such case... BTW, wouldn't that WARN_ON() in dget() belong in lockref_get()?