On Sat, 5 Oct 2024 at 14:42, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > > and I think that might work, although the zero count case worries me > (ie 'fput twice'). > > Currently we avoid the fput twice because we use that > "inc_not_zero()". So that needs some thinking about. Actually, it's worse. Even the if (ret > 1) case is dangerous, because we could have two or more threads doing that atomic_inc_return() on a dead file descriptor at the same time. So that approach is just broken. Linus