linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anand Jain <anand.jain@oracle.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.com
Subject: [PATCH 1/4] btrfs-progs: tune use the latest bdev in fs_devices for super_copy
Date: Fri, 15 Sep 2023 12:08:56 +0800	[thread overview]
Message-ID: <f0c522ee29a3404271058f482233d55183ea5df8.1694749532.git.anand.jain@oracle.com> (raw)
In-Reply-To: <cover.1694749532.git.anand.jain@oracle.com>

Currently, btrfstune relies on the superblock of the device specified
in the btrfstune argument for fs_info::super_copy. However, it should
use fs_devices::latest_bdev, as it points to the device with the highest
fs_devices::generation number. This will contain the superblock updates
that other devices may have missed and we can now support reuniting
devices following failures of btrfstune -m|M|u|U as in the patches:

   btrfs-progs: add support to fix superblock with CHANGING_FSID_V2 flag
   btrfs-progs: recover from the failed btrfstune -m|M

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 tune/main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tune/main.c b/tune/main.c
index 902c9d97956e..2d8f2b012caf 100644
--- a/tune/main.c
+++ b/tune/main.c
@@ -345,6 +345,9 @@ int BOX_MAIN(btrfstune)(int argc, char *argv[])
 		goto free_out;
 	}
 
+	if (change_metadata_uuid || random_fsid || new_fsid_str)
+		ctree_flags |= OPEN_CTREE_USE_LATEST_BDEV;
+
 	root = open_ctree_fd(fd, device, 0, ctree_flags);
 
 	if (!root) {
-- 
2.38.1


  reply	other threads:[~2023-09-15  4:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15  4:08 [PATCH 0/4 v4] btrfs-progs: recover from failed metadata_uuid port kernel Anand Jain
2023-09-15  4:08 ` Anand Jain [this message]
2023-09-15  4:08 ` [PATCH 2/4] btrfs-progs: add support to fix superblock with CHANGING_FSID_V2 flag Anand Jain
2023-09-15  4:08 ` [PATCH 3/4] btrfs-progs: recover from the failed btrfstune -m|M Anand Jain
2023-09-15  4:08 ` [PATCH 4/4] btrfs-progs: test btrfstune -m|M ability to fix previous failures Anand Jain
2023-10-02 17:16   ` David Sterba
2023-10-02 17:19   ` David Sterba
2023-10-03  8:00     ` Anand Jain
2023-10-03  8:38       ` Anand Jain
2023-10-03 17:36         ` David Sterba
2023-10-02 17:00 ` [PATCH 0/4 v4] btrfs-progs: recover from failed metadata_uuid port kernel 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=f0c522ee29a3404271058f482233d55183ea5df8.1694749532.git.anand.jain@oracle.com \
    --to=anand.jain@oracle.com \
    --cc=dsterba@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).