Bug 255030 - fsck -p dumps core on gjournaled FS
Summary: fsck -p dumps core on gjournaled FS
Status: Closed DUPLICATE of bug 245907
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-04-13 10:00 UTC by nvass
Modified: 2021-05-21 20:39 UTC (History)
2 users (show)

See Also:

Script to trigger the behaviour (211 bytes, text/plain)
2021-04-13 10:00 UTC, nvass
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description nvass 2021-04-13 10:00:36 UTC
Created attachment 224076 [details]
Script to trigger the behaviour

Fsck in preen mode dumps core when trying to check a gjournaled filesystem. Only full fsck can check and repair a gjournaled fs. The attached script can be used to reproduce this behaviour.

> root@sheep:~ # fsck -p /dev/md100.journal
> fsck: /dev/md100.journal: Segmentation fault
> root@sheep:~ #
Comment 1 crypt47 2021-04-15 10:53:05 UTC
I've reported this bug as of FreeBSD 12.1 or 12.2 and no I'm here to notify it's still present in F13 release.
Comment 2 Robert Wing freebsd_committer 2021-05-20 19:55:40 UTC

*** This bug has been marked as a duplicate of bug 245907 ***
Comment 3 commit-hook freebsd_committer 2021-05-21 20:39:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=f190f9193bc10a8193c87e0a02fa91400e4eb159

commit f190f9193bc10a8193c87e0a02fa91400e4eb159
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2021-05-21 20:41:40 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2021-05-21 20:42:37 +0000

    Fix fsck_ufs segfaults with gjournal (SU+J)

    The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c)
    while attempting to traverse the buffer cache to flush dirty buffers.
    The tail queue used for the buffer cache was not initialized before
    dropping into gjournal_check(). Move the buffer initialization earlier
    so that it has been done before calling gjournal_check().

    Reported by:  crypt47, nvass
    Fix by:       Robert Wing
    Tested by:    Robert Wing
    PR:           255030
    PR:           255979
    MFC after:    3 days
    Sponsored by: Netflix

 sbin/fsck_ffs/main.c  | 1 +
 sbin/fsck_ffs/setup.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)