On Tue, 31 Oct 2023 at 22:45, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote: > > On Wed, Nov 01, 2023 at 06:20:58AM +0000, Al Viro wrote: > > Calls of retain_dentry() happen immediately after getting false > > from fast_dput() and getting true from retain_dentry() is > > treated the same way as non-zero refcount would be treated by > > fast_dput() - unlock dentry and bugger off. > > > > Doing that in fast_dput() itself is simpler. > > FWIW, I wonder if it would be better to reorganize it a bit - Hmm. Yes. Except I don't love how the retaining logic is then duplicated. Could we perhaps at least try to share the dentry flag tests between the "real" retain_dentry() code and the lockless version? > Another thing: would you mind > > #if USE_CMPXCHG_LOCKREF > extern int lockref_put_return(struct lockref *); > #else > static inline int lockref_put_return(struct lockref *l) > { > return -1; > } > #endif > > in include/linux/lockref.h? Would be useful on DEBUG_SPINLOCK configs... The above sounds like a good idea, not only for better code generation for the debug case, but because it would have possibly made the erofs misuse more obvious to people. Linus