]> git.sesse.net Git - bcachefs-tools-debian/commit
bcachefs-tools: fix broken libblkid superblock wipe
authorBrian Foster <bfoster@redhat.com>
Fri, 17 Nov 2023 13:12:58 +0000 (08:12 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 17 Nov 2023 20:09:27 +0000 (15:09 -0500)
commit83bc15eefe8560b8b918386da5fbfb2a1a9500fa
tree264e0245a2a46978540b846e9450bb082ca688fa
parent1331759db5f90664142f561a258372eebe47c4a6
bcachefs-tools: fix broken libblkid superblock wipe

When playing around with comparing some fstests results on different
filesystems, I noticed that a 'bcachefs format' of a previously
btrfs-formatted device still continued to mount as btrfs. The reason
for this is that the blkid wipe invoked via open_for_format() is not
working correctly. blkid_do_wipe() depends on the "SBMAGIC[_OFFSET]"
values to do any work, and the associated superblock magic flag is
not enabled on the probe.

Set the probe flags to explicitly enable the values the bcachefs
code depends on in the probe. This includes the type, label and
superblock magic information.

There are also a couple quirks in the libblkid code that might be
worth noting. One is that the superblock enablement and flag setting
functions appear hardcoded to return zero, so we just combine the
error checks. Second, while blkid_do_wipe() can return an error, it
actually doesn't in the scenario being addressed here because it
doesn't seem to distinguish between the values being absent because
nothing was found by the probe or because the values weren't enabled
in the first place. Regardless, add an error check here in the event
the wipe does explicitly fail for some unexpected reason.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
tools-util.c