Skip to contentSkip to conversation

btrfs-progs: image: Warn about log tree generation mismatch when restore

PATCH Applied Qu Wenruo 2 participants 2 messages Oct 4, 2018 – Oct 25, 2018 Btrfs file system

lore
Share & tools
lore

Qu Wenruo

author
#0 lore raw

PATCH 1/1 btrfs-progs: image: Warn about log tree generation mismatch when restore

At restore time, btrfs-image will try to fixup dev extents, this will trigger a transaction.

It's normally OK to start a new transaction, but for image with log tree, a new transaction will bump up generation, and log tree generation will not match with super block generation + 1.

There is no good way to solve it yet. Just output a warning for now.

---
 image/main.c | 4 ++++
 1 file changed, 4 insertions(+)
image/main.c +4 -0
index 351c5a256938..40fe406d8a33 100644
@@ -2093,6 +2093,10 @@ static int fixup_devices(struct btrfs_fs_info *fs_info,
 	u64 devid, cur_devid;
 	int ret;
 
+	if (btrfs_super_log_root(fs_info->super_copy)) {
+		warning(
+		"log tree detected, log tree generation will be suspicious");
+	}
 	trans = btrfs_start_transaction(fs_info->tree_root, 1);
 	if (IS_ERR(trans)) {
 		error("cannot starting transaction %ld", PTR_ERR(trans));
Signature · 1 line
2.19.0
Applied
#1 lore raw
Quoted 10 lines · Qu Wenruo

At restore time, btrfs-image will try to fixup dev extents, this will trigger a transaction.

It's normally OK to start a new transaction, but for image with log tree, a new transaction will bump up generation, and log tree generation will not match with super block generation + 1.

There is no good way to solve it yet. Just output a warning for now.

Applied, thanks.