On 01/09/2018 03:03 AM, David Sterba wrote:
On Tue, Nov 21, 2017 at 06:15:24PM +0800, Su Yue wrote:check_fs_roots() will check all fs trees again if fs_info->tree_root have been cowed. It is inefficient if there are many subvolumes in filesystem. And it also causes dead loop while repairing fuzz-tests/images/bko-161811.raw: ============================= ERROR: DIR_ITEM[256 1167283096] name namelen 32 filetype 1 mismatch with its hash, wanted 1167283096 have 709597396 invalid location in dir item 0 root 5 root dir 256 error root 5 inode 256 errors 10, odd dir item Failed to reset nlink for inode 18446744073709551361: No such file or directory unresolved ref dir 256 index 0 namelen 32 name filetype 1 errors 106, no dir index, no inode ref, name too long ERROR: DIR_ITEM[256 1167283096] name namelen 32 filetype 1 mismatch with its hash, wanted 1167283096 have 709597396 invalid location in dir item 0 root 5 root dir 256 error root 5 inode 256 errors 10, odd dir item Failed to reset nlink for inode 18446744073709551361: No such file or directory unresolved ref dir 256 index 0 namelen 32 name filetype 1 errors 106, no dir index, no inode ref, name too long ERROR: DIR_ITEM[256 1167283096] name namelen 32 filetype 1 mismatch with its hash, wanted 1167283 ... ============================== Process of the dead loop: 1) check_fs_root() failed to repair the inode. 2) btrfs_commit_transaction() did cow of the fs_info->tree_root 3) check_fs_roots() restarted to check fs tree. 4) goto 1). Introduce a variable @prev_key to record last checked root_item. If check_fs_root() failed, go to check the next fs_tree instead of trying it again and again.Patch looks good to me, do you have a test image?
fuzz-tests/images/bko-161811.raw there is. Or do I need to add an another case to fsck-tests? Thanks, Su
-- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
