mbox series

[00/11] btrfs-progs: fix bugs and CHANGING_FSID_V2 flag

Message ID cover.1688724045.git.anand.jain@oracle.com (mailing list archive)
Headers show
Series btrfs-progs: fix bugs and CHANGING_FSID_V2 flag | expand

Message

Anand Jain July 7, 2023, 3:52 p.m. UTC
Btrfstune currently lacks support for fixing incomplete or broken
previous runs. Instead, it relies on the kernel to assemble the
correct set of devices based on metadata_uuid, generation, and
the CHANGE_FSID_V2 flag.

However, depending on the kernel to handle this interim change_fsid
state may not be suitable for all situations. For instance, if
there are other fsids sharing the same metadata_uuid but are not
part of the incomplete fsid, the assembly process in the kernel
may not be transparent or controllable to the user. So, this patch
set bring the ability to fix incomplete fsid changes to the userland
using btrfstune.

This patch set fixes bugs as in the individual change log,
introduces new fs_devices members and helper functions, and
the last patch provides the feature discussed.

To ensure proper device assembly and to mitigate any potential
incorrect assembly this feature is behind the --noscan and
--device options. And calls automatically, however I am ok to
add another option like --fix-changing_fsid if you think it
makes sense. However, I don't think it is needed as of now
the kernel does it with all normal options.

This patch set depends on:

 --noscan and --device option:
  [PATCH 00/10] btrfs-progs: check and tune: add device and noscan options


Testing:

The btrfs-progs tests/misc-tests/034-metadata_uuid include a series of 4
disk images that contain incomplete fsid states (changing_fsid).

To evaluate this patch set, the images were tested using a local script,
which is not yet prepared for submission.

The typical testing steps involve:

	xz --uncompress --keep <imgs>

	btrfstune -m --noscan --device=disk1.raw disk2.raw
	btrfstune -m --noscan --device=disk2.raw disk1.raw

	btrfstune -m --noscan --device=disk3.raw disk4.raw
	btrfstune -m --noscan --device=disk4.raw disk3.raw

	and so on.

I plan to migrate misc-test/034-metadata_uuid test cases to assess
btrfstune, as the kernel's support for fixing the changing_fsid state
will be removed.

This patch set has successfully passed the btrfs-progs test cases.

Thanks.

Anand Jain (11):
  btrfs-progs: fix duplicate missing device
  btrfs-progs: call warn() for missing device
  btrfs-progs: track missing device counter
  btrfs-progs: NULL initialize device name for missing
  btrfs-progs: tune: check for missing device
  btrfs-progs: track changing_fsid flag in fs_devices
  btrfs-progs: track num_devices per fs_devices
  btrfs-progs: track total_devs in fs devices
  btrfs-progs: track active metadata_uuid per fs_devices
  btrfs-progs: add helper to reunite devices with same metadata_uuid
  btrfs-progs: tune: fix incomplete fsid_change

 common/device-scan.c        | 42 ++++++++++++++++
 common/device-scan.h        |  1 +
 kernel-shared/volumes.c     | 99 +++++++++++++++++++++++++++++++++++--
 kernel-shared/volumes.h     |  8 +++
 tune/change-metadata-uuid.c |  4 +-
 tune/change-uuid.c          |  4 +-
 tune/main.c                 | 16 +++++-
 7 files changed, 166 insertions(+), 8 deletions(-)