> Thread 20558 holds an AGI buffer and is trying to grab the ILOCK of the > root directory. Thread 20559 holds the root directory ILOCK and is > trying to grab the AGI of an inode that is one of the root directory's > children. The AGI held by 20558 is the same buffer that 20559 is trying > to acquire. In other words, this is an ABBA deadlock. > > In general, the lock order is ILOCK and then AGI -- rename does this > while preparing for an operation involving whiteouts or renaming files > out of existence; and unlink does this when moving an inode to the > unlinked list. The only place where we do it in the opposite order is > on the child during an icreate, but at that point the child is marked > INEW and is not visible to other threads. > > Work around this deadlock by replacing the blocking ilock attempt with a > nonblocking loop that aborts after 30 seconds. Relax for a jiffy after > a failed lock attempt. Trylock and wait schemes are sketchy as hell. Why do we need to hold the AGI lock when walking the directory?