In an overlay directory that shadows an empty lower directory, say /mnt/a/empty102, do: touch /mnt/a/empty102/x unlink /mnt/a/empty102/x rmdir /mnt/a/empty102 It's actually harmless, but needs another level of nesting between I_MUTEX_CHILD and I_MUTEX_NORMAL.
Showing the changes to include/linux (1 of 3 files). Show all
Unified · Split
| @@ -639,11 +639,13 @@ static inline int inode_unhashed(struct inode *inode) · 638 unmodified lines | ||
| 639 | 639 | * 2: child/target |
| 640 | 640 | * 3: xattr |
| 641 | 641 | * 4: second non-directory |
| 642 | − * The last is for certain operations (such as rename) which lock two | |
| 642 | + * 5: second parent (when locking independent directories in rename) | |
| 643 | + * | |
| 644 | + * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two | |
| 643 | 645 | * non-directories at once. |
| 644 | 646 | * |
| 645 | 647 | * The locking order between these classes is |
| 646 | − * parent -> child -> normal -> xattr -> second non-directory | |
| 648 | + * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory | |
| 647 | 649 | */ |
| 648 | 650 | enum inode_i_mutex_lock_class |
| 649 | 651 | { |
| @@ -651,7 +653,8 @@ enum inode_i_mutex_lock_class · 1 unmodified line | ||
| 651 | 653 | I_MUTEX_PARENT, |
| 652 | 654 | I_MUTEX_CHILD, |
| 653 | 655 | I_MUTEX_XATTR, |
| 654 | − I_MUTEX_NONDIR2 | |
| 656 | + I_MUTEX_NONDIR2, | |
| 657 | + I_MUTEX_PARENT2, | |
| 655 | 658 | }; |
| 656 | 659 | |
| 657 | 660 | void lock_two_nondirectories(struct inode *, struct inode*); |