linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: image: Warn about log tree generation mismatch when restore
Date: Thu,  4 Oct 2018 14:02:13 +0800	[thread overview]
Message-ID: <20181004060213.13022-1-wqu@suse.com> (raw)

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.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 image/main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/image/main.c b/image/main.c
index 351c5a256938..40fe406d8a33 100644
--- a/image/main.c
+++ b/image/main.c
@@ -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));
-- 
2.19.0


             reply	other threads:[~2018-10-04  6:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04  6:02 Qu Wenruo [this message]
2018-10-25 12:08 ` [PATCH] btrfs-progs: image: Warn about log tree generation mismatch when restore David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181004060213.13022-1-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).