On Wed, Jan 18, 2023 at 08:44:57AM +1100, Dave Chinner wrote: > XFS just has a function that allows for an arbitrary number of > inodes to be locked in the given order: xfs_lock_inodes(). For > rename, the lock order is determined by xfs_sort_for_rename(). bcachefs does the same thing - we just sort and dedup the inodes being locked, lock order is always pointer ordering. Is there some reason we couldn't do the same for inode locks? Then pointer order would be the only lock ordering, no child/descendent stuff. On a related note, I also just sent Peter Zijlstra a lockdep patch so that we can define an ordering within a class - soon we'll be able to have lockdep check that we're taking locks in pointer order, or whatever ordering we decide.