Bug 245916

Summary: Superblock check-hash failed
Product: Base System Reporter: Edward Tomasz Napierala <trasz>
Component: kernAssignee: freebsd-fs (Nobody) <fs>
Status: Closed FIXED    
Severity: Affects Only Me CC: chris, cragapito, emaste, mckusick
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Edward Tomasz Napierala freebsd_committer freebsd_triage 2020-04-25 23:23:31 UTC
At each boot I see the following two lines:

Apr 26 00:08:25 brick kernel: Superblock check-hash failed: recorded check-hash 0x448c1e8e != computed check-hash 0x25558058 (Ignored)
Apr 26 00:08:25 brick kernel: Superblock check-hash failed: recorded check-hash 0x448c1e8e != computed check-hash 0x3f3b2dc7 (Ignored)

The error message is quite self-explanatory; thing is, I'd expect fsck(8) to fix this problem.  And that doesn't happen - fsck neither complains about it nor fixes it.
Comment 1 cragapito@gmail.com 2021-11-09 22:03:34 UTC
I had the same problem, but fsck made my old system unusable trying recover that check-hashes, and worst, it damage my backup disk! I can't mount it because after the messages it gave me 'mount:  Integrity check failed'.

fsck says that's clean, but I still cant mount (despite messages that it was ignored).

I share that backup disk between machines with different versions, but I never even dream about that level of regression next to my 20 year with FreeBSD.

I appreciate the attempt to evolve, but I found it rash and irresponsible.
Comment 2 cragapito@gmail.com 2021-11-10 18:48:44 UTC
Googling I could recover the backup of SB, got by 'newfs -N /dev/da0' at 192 and using 'fsck_ufs -b 192 /dev/da0'. Now it's working. Sorry by my previous message...
Comment 3 Kirk McKusick freebsd_committer freebsd_triage 2021-11-18 22:01:17 UTC
I have managed to reproduce this problem and I am working on a fix.
Comment 4 commit-hook freebsd_committer freebsd_triage 2022-02-04 19:49:04 UTC
A commit in branch main references this bug:

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

commit c0bfa109b942659f609b7e2bf3ba042ec0cb3f9d
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-02-04 19:46:36 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-02-04 19:47:48 +0000

    Have fsck_ffs(8) properly correct superblock check-hash failures.

    Part of the problem was that fsck_ffs would read the superblock
    multiple times complaining and repairing the superblock check hash
    each time and then at the end failing to write out the superblock
    with the corrected check hash. This fix reads the superblock just
    once and if the check hash is corrected ensures that the fixed
    superblock gets written.

    Tested by:    Peter Holm
    PR:           245916
    MFC after:    1 week
    Sponsored by: Netflix

 sbin/fsck_ffs/fsck.h   |   1 +
 sbin/fsck_ffs/fsutil.c |   4 +-
 sbin/fsck_ffs/globs.c  |   6 +-
 sbin/fsck_ffs/main.c   | 309 +++++++++++++++++++++++++++++++++----------------
 sbin/fsck_ffs/setup.c  | 182 +++++++----------------------
 5 files changed, 258 insertions(+), 244 deletions(-)
Comment 5 Kirk McKusick freebsd_committer freebsd_triage 2022-02-04 19:52:15 UTC
Fix added to head. Will close after MFC to 13.
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-02-16 01:15:36 UTC
A commit in branch stable/13 references this bug:

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

commit 166926a3dee05875b9cb38356871d9ce07083c0d
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-02-16 01:09:07 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-02-16 01:14:22 +0000

    Have fsck_ffs(8) properly correct superblock check-hash failures.

    cherry pick cleanups from commit c0bfa109b942659f609b7e2bf3ba042ec0cb3f9d

    PR:           245916

 sbin/fsck_ffs/main.c  | 2 +-
 sbin/fsck_ffs/setup.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-02-16 01:15:38 UTC
A commit in branch stable/13 references this bug:

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

commit efd949aaba7449ae994fe5052178c2ba3efd2e7b
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2022-02-04 19:46:36 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2022-02-16 01:14:22 +0000

    Have fsck_ffs(8) properly correct superblock check-hash failures.

    (cherry picked from commit c0bfa109b942659f609b7e2bf3ba042ec0cb3f9d)

    PR:           245916

 sbin/fsck_ffs/fsck.h   |   1 +
 sbin/fsck_ffs/fsutil.c |   4 +-
 sbin/fsck_ffs/globs.c  |   6 +-
 sbin/fsck_ffs/main.c   | 309 +++++++++++++++++++++++++++++++++----------------
 sbin/fsck_ffs/setup.c  | 182 +++++++----------------------
 5 files changed, 258 insertions(+), 244 deletions(-)
Comment 8 Kirk McKusick freebsd_committer freebsd_triage 2022-02-16 01:18:06 UTC
Has been MFC'ed to 13