From: Su Yue <Damenly_Su@xxxxxxx>
Progs now is able to handle the metadata_uuid feature without kernel
help, clear the FSID_CHANGING_V2 flag if latest device is marked as
changing.
Signed-off-by: Su Yue <Damenly_Su@xxxxxxx>
---
disk-io.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/disk-io.c b/disk-io.c
index 659f8b93a7ca..09dacbc83e06 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -1177,6 +1177,7 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
int ret;
int oflags;
unsigned sbflags = SBREAD_DEFAULT;
+ u64 sflags; /* records btrfs_super_flags */
if (sb_bytenr == 0)
sb_bytenr = BTRFS_SUPER_INFO_OFFSET;
@@ -1242,12 +1243,19 @@ static struct btrfs_fs_info *__open_ctree_fd(int fp, const char *path,
goto out_devices;
}
- if (btrfs_super_flags(disk_super) & BTRFS_SUPER_FLAG_CHANGING_FSID &&
+ sflags = btrfs_super_flags(disk_super);
+ if (sflags & BTRFS_SUPER_FLAG_CHANGING_FSID &&
!fs_info->ignore_fsid_mismatch) {
fprintf(stderr, "ERROR: Filesystem UUID change in progress\n");
goto out_devices;
}
+ if (sflags & BTRFS_SUPER_FLAG_CHANGING_FSID_V2) {
+ sflags &= ~BTRFS_SUPER_FLAG_CHANGING_FSID_V2;
+ btrfs_set_super_flags(disk_super, sflags);
+ printf("Found metadata UUID change in progress flag, clearing\n");
+ }
+
ASSERT(!memcmp(disk_super->fsid, fs_devices->fsid, BTRFS_FSID_SIZE));
ASSERT(!memcmp(disk_super->fsid, fs_devices->fsid, BTRFS_FSID_SIZE));
if (btrfs_fs_incompat(fs_info, METADATA_UUID))
--
2.21.0 (Apple Git-122.2)