[Bug 256746] fsck_ffs completely broken for background fsck

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 21 Jun 2021 12:07:54 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=256746

            Bug ID: 256746
           Summary: fsck_ffs completely broken for background fsck
           Product: Base System
           Version: 13.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: andrew@tao11.riddles.org.uk
                CC: mckusick@FreeBSD.org

Commit 5cc52631b3b88 completely breaks background fsck by trying to open the
device for writing (which is of course disallowed because it is mounted) too
early in the process. This affects 13.0 release, 13-stable and current.

To reproduce: have any filesystem other than / with softupdates enabled but not
journalling; force a reboot with for example reboot -qn when the filesystem is
mounted and dirty; observe that in /var/log/messages 60 seconds after booting a
message like this shows up:

Jun 21 11:40:48 hel fsck[784]: /dev/vtbd1: NO WRITE ACCESS
Jun 21 11:40:48 hel fsck[784]: /dev/vtbd1: UNEXPECTED INCONSISTENCY; RUN fsck
MANUALLY.
Jun 21 11:40:48 hel fsck[784]: /dev/vtbd1: CANNOT SET FS_NEEDSFSCK FLAG

The code at fsck_ffs/main.c:298 should probably be inside the FS_GJOURNAL
condition, or otherwise refactored; it's obviously completely wrong as it
stands. (Note that -p sets ckclean, and skipclean is set by default).

-- 
You are receiving this mail because:
You are the assignee for the bug.