Bug 276944 - no kernel panic after forcible unmount of /
Summary: no kernel panic after forcible unmount of /
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 13.2-STABLE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Chuck Silvers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-10 16:31 UTC by John F. Carr
Modified: 2024-03-20 21:27 UTC (History)
2 users (show)

See Also:
linimon: mfc-stable13?


Attachments
crash screenshot (458.86 KB, image/jpeg)
2024-02-10 16:31 UTC, John F. Carr
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description John F. Carr 2024-02-10 16:31:10 UTC
Created attachment 248309 [details]
crash screenshot

My system was hung because the kernel failed to panic after / was forcibly unmounted due to an I/O error.  There is code in ffs_fsfail_cleanup_locked to panic in this case.  It did not work.  The system kept running but processes crashed as they tried to page in from the bad disk.

Key lines below.  See attached screenshot for more.  There are no log messages because /var/log/messages is on the bad disk.  I am running a stable/13 kernel ("13.3-STABLE") on an old amd64 system.

g_vfs_done():ada0p2[WRITE(offset=1392508928, length=20480)]error=6
UFS: forcibly unmounting /dev/ada0p2 from /
swap_pager: I/O error - pagein failed
Comment 1 Konstantin Belousov freebsd_committer freebsd_triage 2024-02-11 01:34:25 UTC
Until init is killed, the system is going to stay on.
Comment 2 John F. Carr 2024-02-11 14:24:14 UTC
(In reply to Konstantin Belousov from comment #1)

There is code to panic when / is unmounted:

		if (ump->um_mountp == rootvnode->v_mount)
			panic("UFS: root fs would be forcibly unmounted");

It didn't trigger on my system because the panic is only in 14.0 and newer. So this bug report is a request to merge 60a41168d195cc09f7351c2c2bcafc389ed52406 to stable/13.
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2024-02-13 20:15:14 UTC
^Triage: over to committer of 60a41168d195cc09f7351c2c2bcafc389ed52406 for possible MFC.
Comment 4 Li-Wen Hsu freebsd_committer freebsd_triage 2024-02-27 10:22:44 UTC
Over to actual committer of 60a41168d195cc09f7351c2c2bcafc389ed52406
Comment 5 commit-hook freebsd_committer freebsd_triage 2024-03-20 21:25:48 UTC
A commit in branch stable/13 references this bug:

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

commit 083608e4669e0eb3d31d4e7d9ced00ae822807e6
Author:     Chuck Silvers <chs@FreeBSD.org>
AuthorDate: 2023-08-10 16:55:47 +0000
Commit:     Chuck Silvers <chs@FreeBSD.org>
CommitDate: 2024-03-20 20:25:49 +0000

    UFS: panic rather than forcibly unmount the root fs

    If the root fs is forcibly unmounted then basically every process
    will die with a SEGV as soon as it tries to run again because libc.so
    is gone, which leaves the system basically hung.  It seems better
    to just panic instead, so let's do that.

    PR:             276944
    Requested-by:   karels
    Reviewed-by:    imp, mckusick, karels
    Sponsored-by:   Netflix
    Differential Revision:  https://reviews.freebsd.org/D41387

    (cherry picked from commit 60a41168d195cc09f7351c2c2bcafc389ed52406)

 sys/ufs/ffs/ffs_vfsops.c | 3 +++
 1 file changed, 3 insertions(+)
Comment 6 Chuck Silvers freebsd_committer freebsd_triage 2024-03-20 21:27:36 UTC
MFC'd to stable/13 today.