From: Darrick J. Wong <djwong@xxxxxxxxxx> commit 53b001a21c9dff73b64e8c909c41991f01d5d00f upstream. Debugging a filesystem patch with generic/475 caused the system to hang after observing the following sequences in dmesg: XFS (dm-0): metadata I/O error in "xfs_imap_to_bp+0x61/0xe0 [xfs]" at daddr 0x491520 len 32 error 5 XFS (dm-0): metadata I/O error in "xfs_btree_read_buf_block+0xba/0x160 [xfs]" at daddr 0x3445608 len 8 error 5 XFS (dm-0): metadata I/O error in "xfs_imap_to_bp+0x61/0xe0 [xfs]" at daddr 0x138e1c0 len 32 error 5 XFS (dm-0): log I/O error -5 XFS (dm-0): Metadata I/O Error (0x1) detected at xfs_trans_read_buf_map+0x1ea/0x4b0 [xfs] (fs/xfs/xfs_trans_buf.c:311). Shutting down filesystem. XFS (dm-0): Please unmount the filesystem and rectify the problem(s) XFS (dm-0): Internal error dqp->q_ino.reserved < dqp->q_ino.count at line 869 of file fs/xfs/xfs_trans_dquot.c. Caller xfs_trans_dqresv+0x236/0x440 [xfs] XFS (dm-0): Corruption detected. Unmount and run xfs_repair XFS (dm-0): Unmounting Filesystem be6bcbcc-9921-4deb-8d16-7cc94e335fa7 The system is stuck in unmount trying to lock a couple of inodes so that they can be purged. The dquot corruption notice above is a clue to what happened -- a link() call tried to set up a transaction to link a child into a directory. Quota reservation for the transaction failed after IO errors shut down the filesystem, but then we forgot to unlock the inodes on our way out. Fix that. Cc: <stable@xxxxxxxxxxxxxxx> # v6.10 Fixes: bd5562111d5839 ("xfs: Hold inode locks in xfs_trans_alloc_dir") Signed-off-by: "Darrick J. Wong" <djwong@xxxxxxxxxx> Reviewed-by: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_trans.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c @@ -1374,5 +1374,8 @@ done: out_cancel: xfs_trans_cancel(tp); + xfs_iunlock(dp, XFS_ILOCK_EXCL); + if (dp != ip) + xfs_iunlock(ip, XFS_ILOCK_EXCL); return error; } Patches currently in stable-queue which might be from djwong@xxxxxxxxxx are queue-6.12/xfs-return-a-64-bit-block-count-from-xfs_btree_count_blocks.patch queue-6.12/xfs-don-t-drop-errno-values-when-we-fail-to-ficlone-the-entire-range.patch queue-6.12/xfs-fix-scrub-tracepoints-when-inode-rooted-btrees-are-involved.patch queue-6.12/xfs-update-btree-keys-correctly-when-_insrec-splits-an-inode-root-block.patch queue-6.12/xfs-unlock-inodes-when-erroring-out-of-xfs_trans_alloc_dir.patch queue-6.12/xfs-set-xfs_sick_ino_symlink_zapped-explicitly-when-zapping-a-symlink.patch queue-6.12/xfs-fix-null-bno_hint-handling-in-xfs_rtallocate_rtg.patch queue-6.12/xfs-only-run-precommits-once-per-transaction-object.patch queue-6.12/xfs-return-from-xfs_symlink_verify-early-on-v4-filesystems.patch