fsck: use BLKID_SUBLKS_BADCSUM

We need to be a little bit more promiscuou in fsck to see also
inconsistent superblocks.

It would be possible to do not use libmount to ask for filesystem type
and ask directly libblkid, but libmount is also used to parse fstab
and search in the file and in this case it caches FS tags. It seems
better to continue with libmount to reduce overhead and keep the code
simple.

Addresses: https://github.com/util-linux/util-linux/issues/2214
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2023-05-09 13:25:09 +02:00
parent 128c416d5c
commit 10d477ac78

View file

@ -1630,6 +1630,16 @@ int main(int argc, char *argv[])
mnt_init_debug(0); /* init libmount debug mask */
mntcache = mnt_new_cache(); /* no fatal error if failed */
if (mntcache)
/* Force libblkid to accept also filesystems with bad
* checksums. This feature is helpful for "fsck /dev/foo," but
* if it evaluates LABEL/UUIDs from fstab, then libmount may
* use cached data from udevd and udev accepts only properly
* detected filesystems.
*/
mnt_cache_set_sbprobe(mntcache, BLKID_SUBLKS_BADCSUM);
parse_argv(argc, argv);
if (!notitle)