]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: flush inode gc workqueue before clearing agi bucket
authorZhang Yi <yi.zhang@huawei.com>
Thu, 14 Jul 2022 01:36:36 +0000 (11:36 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 14 Jul 2022 01:36:36 +0000 (11:36 +1000)
commitc9ef00a2b2fd5bd4bd14b599607f90126f9b6ef7
tree415acfc4225c93d10166c41dd4b8dff0e363c79b
parent9eb1c6b22930b75677c57b6f2740d95314ea0fd4
xfs: flush inode gc workqueue before clearing agi bucket

In the procedure of recover AGI unlinked lists, if something bad
happenes on one of the unlinked inode in the bucket list, we would call
xlog_recover_clear_agi_bucket() to clear the whole unlinked bucket list,
not the unlinked inodes after the bad one. If we have already added some
inodes to the gc workqueue before the bad inode in the list, we could
get below error when freeing those inodes, and finaly fail to complete
the log recover procedure.

 XFS (ram0): Internal error xfs_iunlink_remove at line 2456 of file
 fs/xfs/xfs_inode.c.  Caller xfs_ifree+0xb0/0x360 [xfs]

The problem is xlog_recover_clear_agi_bucket() clear the bucket list, so
the gc worker fail to check the agino in xfs_verify_agino(). Fix this by
flush workqueue before clearing the bucket.

Fixes: d9fa3782d696 ("xfs: per-cpu deferred inode inactivation queues")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_log_recover.c