Bug 243196 - [geom_journal] panic unloading geom_journal driver
Summary: [geom_journal] panic unloading geom_journal driver
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: Mark Johnston
URL:
Keywords: crash
Depends on:
Blocks:
 
Reported: 2020-01-08 18:59 UTC by Alfredo Dal'Ava Junior
Modified: 2022-10-12 00:50 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alfredo Dal'Ava Junior freebsd_committer freebsd_triage 2020-01-08 18:59:57 UTC
I hit a kernel panic when unloading some geom drivers on a PowerPC64 QEMU virtual machine:


[root@alfredo-2 /boot/kernel]# kldload geom_*
[root@alfredo-2 /boot/kernel]# kldunload geom_*
panic: Assertion g_journal_switcher_proc != NULL failed at /usr/src/sys/geom/journal/g_journal.c:2970
cpuid = 15
time = 1578519766
KDB: stack backtrace:
0xe0000000641650f0: at kdb_backtrace+0x60
0xe000000064165200: at vpanic+0x1d8
0xe0000000641652b0: at panic+0x40
0xe0000000641652e0: at g_journal_fini+0x268
0xe000000064165390: at g_modevent+0x394
0xe000000064165430: at module_unload+0x70
0xe000000064165470: at linker_file_unload+0x290
0xe000000064165530: at kern_kldunload+0x148
0xe0000000641655e0: at sys_kldunloadf+0x34
0xe000000064165610: at trap+0xd58
0xe000000064165750: at powerpc_interrupt+0x1b8
0xe0000000641657e0: user SC trap by 0x810132350: srr1=0x800000000200f032
            r1=0x3fffffffffffcef0 cr=0x42820b80 xer=0 ctr=0x810132340 r2=0x8102d2378 frame=0xe000000064165810
KDB: enter: panic
[ thread pid 40190 tid 100614 ]
Stopped at      kdb_enter+0x78: ori     r0, r0, 0x0



FreeBSD  13.0-CURRENT FreeBSD 13.0-CURRENT #0 r356261: Thu Jan  2 05:59:33 UTC 2020     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/powerpc.powerpc64/sys/GENERIC64  powerpc
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2020-01-08 19:32:01 UTC
Not PPC-specific, I was able to reproduce on x86:

testvm# for x in geom_* ; do kldunload $x ; done
kldunload: can't find file geom_bde.ko
kldunload: can't find file geom_cache.ko
kldunload: can't find file geom_ccd.ko
kldunload: can't find file geom_concat.ko
kldunload: can't find file geom_eli.ko
kldunload: can't find file geom_flashmap.ko
panic: Assertion g_journal_switcher_proc != NULL failed at /usr/home/conrad/src/freebsd/sys/geom/journal/g_journal.c:2970
cpuid = 0
time = 1578511869
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00176048e0
vpanic() at vpanic+0x17e/frame 0xfffffe0017604940
panic() at panic+0x43/frame 0xfffffe00176049a0
g_journal_fini() at g_journal_fini+0x15a/frame 0xfffffe00176049c0
g_modevent() at g_modevent+0x2c5/frame 0xfffffe0017604a00
module_unload() at module_unload+0x32/frame 0xfffffe0017604a20
linker_file_unload() at linker_file_unload+0x24b/frame 0xfffffe0017604a80
kern_kldunload() at kern_kldunload+0x10d/frame 0xfffffe0017604ac0
amd64_syscall() at amd64_syscall+0x2d6/frame 0xfffffe0017604bf0
fast_syscall_common() at fast_syscall_common+0x101/frame 0xfffffe0017604bf0
--- syscall (444, FreeBSD ELF64, sys_kldunloadf), rip = 0x8002da60a, rsp = 0x7fffffffd1e8, rbp = 0x7fffffffda40 ---
Comment 2 commit-hook freebsd_committer freebsd_triage 2020-04-03 13:58:22 UTC
A commit references this bug:

Author: markj
Date: Fri Apr  3 13:57:42 UTC 2020
New revision: 359595
URL: https://svnweb.freebsd.org/changeset/base/359595

Log:
  geom_journal: Only stop the switcher process if one was started.

  PR:		243196
  MFC after:	1 week

Changes:
  head/sys/geom/journal/g_journal.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2020-04-10 01:23:28 UTC
A commit references this bug:

Author: markj
Date: Fri Apr 10 01:23:06 UTC 2020
New revision: 359765
URL: https://svnweb.freebsd.org/changeset/base/359765

Log:
  MFC r359595:
  geom_journal: Only stop the switcher process if one was started.

  PR:	243196

Changes:
_U  stable/12/
  stable/12/sys/geom/journal/g_journal.c
Comment 4 Mark Johnston freebsd_committer freebsd_triage 2020-04-10 01:28:38 UTC
Thanks for the report.