Skip to content

Commit ae1238b

Browse files
maharmstonekdave
authored andcommitted
btrfs: read key again after incrementing slot in move_existing_remaps()
Fix move_existing_remaps() so that if we increment the slot because the key we encounter isn't a REMAP_BACKREF, we don't reuse the objectid and offset of the old item. Link: https://lore.kernel.org/linux-btrfs/[email protected]/ Reported-by: Chris Mason <[email protected]> Fixes: bbea42d ("btrfs: move existing remaps before relocating block group") Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Mark Harmstone <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent b2840e3 commit ae1238b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/btrfs/relocation.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4399,6 +4399,8 @@ static int move_existing_remaps(struct btrfs_fs_info *fs_info,
43994399

44004400
leaf = path->nodes[0];
44014401
}
4402+
4403+
btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
44024404
}
44034405

44044406
remap = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_remap_item);

0 commit comments

Comments
 (0)