]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fsck: use BLKID_SUBLKS_BADCSUM
authorKarel Zak <kzak@redhat.com>
Tue, 9 May 2023 11:25:09 +0000 (13:25 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 9 May 2023 11:25:09 +0000 (13:25 +0200)
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>
disk-utils/fsck.c

index 94e2d7c3ebe42c1bb60e2f2fa9c4b11c868e065d..1b11e82614d336534e4b1b21d1fe9023a6b2d387 100644 (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)