From: Karel Zak Date: Tue, 9 May 2023 11:25:09 +0000 (+0200) Subject: fsck: use BLKID_SUBLKS_BADCSUM X-Git-Tag: v2.39~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10d477ac7849eee1ce6ac82b73d6f02ff6db701c;p=thirdparty%2Futil-linux.git 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 --- diff --git a/disk-utils/fsck.c b/disk-utils/fsck.c index 94e2d7c3eb..1b11e82614 100644 --- a/disk-utils/fsck.c +++ b/disk-utils/fsck.c @@ -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)