mirror of
https://github.com/kdave/btrfs-progs
synced 2025-01-13 17:21:05 +00:00
btrfs-progs: check: lowmem: Remove corupted link before readding correct link
For repair_ternary_lowmem() used in lowmem mode, if it found 1 of DIR_INDEX/DIR_ITEM/INODE_REF missing, it will try to insert correct link. However for case like invalid type in DIR_INDEX, we should delete the corrupted DIR_INDEX first before inserting the correct link. This patch will remove the corrupted link before re-inserting. This should solve the duplicated DIR_INDEX problem in old lowmem mode repair. Reported-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Nikolay Borisov <nborisov@suse.com> Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
f7fc27cb20
commit
a5f0e46ac3
@ -635,6 +635,10 @@ int repair_ternary_lowmem(struct btrfs_root *root, u64 dir_ino, u64 ino,
|
||||
goto out;
|
||||
}
|
||||
if (stage == 1) {
|
||||
ret = btrfs_unlink(trans, root, ino, dir_ino, index, name,
|
||||
name_len, 0);
|
||||
if (ret)
|
||||
goto out;
|
||||
ret = btrfs_add_link(trans, root, ino, dir_ino, name, name_len,
|
||||
filetype, &index, 1, 1);
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user