Skip to contentSkip to conversation

btrfs: read key again after incrementing slot in move_existing_remaps()

PATCH In review Mark Harmstone 3 participants 3 messages Feb 25 – Feb 27 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Fixes bbea42dfb91f ("btrfs: move existing remaps before relocating block group")
---
 fs/btrfs/relocation.c | 2 ++
 1 file changed, 2 insertions(+)
fs/btrfs/relocation.c +2 -0
index 5a8644667620..2dee4d708f95 100644
@@ -4394,6 +4394,8 @@ static int move_existing_remaps(struct btrfs_fs_info *fs_info,
 
 				leaf = path->nodes[0];
 			}
+
+			btrfs_item_key_to_cpu(leaf, &key, path->slots[0]);
 		}
 
 		remap = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_remap_item);
Signature · 1 line
2.52.0
#2 lore raw
In reply to Mark Harmstone
Quoted 8 lines · Mark Harmstone

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.

Fixes bbea42dfb91f ("btrfs: move existing remaps before relocating block group")

Added to for-next, thanks.