git: kernel/linker: preserve refs after unload veto
Aaron LI
aly at crater.dragonflybsd.org
Wed Jul 22 07:03:10 PDT 2026
commit e8a1da77a8648711f19f3d9736b7a813ad5ee6b4
Author: Leding Li <lileding at gmail.com>
Date: Sat Jul 11 04:23:34 2026 +0800
kernel/linker: preserve refs after unload veto
linker_file_unload() used to take a temporary file reference (file->refs)
before notifying modules to unload [1]. Its veto path dropped that
temporary reference before returning the error.
The 2009 linker code sync with FreeBSD [2] removed the temporary
reference but retained the decrement. Therefore, every failed kldunload
reduced 'file->refs' even though the file remained loaded, allowing
repeated EBUSY returns to drive the count below zero.
Keep the existing reference when a module vetoes unload. sys_kldunload()
already restores userrefs on error, and a later unload attempt can retry
with both counters unchanged.
[1] Handle recursive situations a bit more robustly ...
commit e7a2d40362352344eff1c4f395caf0a735e00a3e
[2] modules: pull in most of FreeBSD's module linker changes
commit 1c0e32863e0583221e430c22c1c68a023fd16195
GitHub-PR: #50
Summary of changes:
sys/kern/kern_linker.c | 1 -
1 file changed, 1 deletion(-)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e8a1da77a8648711f19f3d9736b7a813ad5ee6b4
--
DragonFly BSD source repository
More information about the Commits
mailing list