Bug 236138 - Unloading a Kernel module dependent on other kernel module does not return device busy first time
Summary: Unloading a Kernel module dependent on other kernel module does not return de...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.2-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-01 19:15 UTC by Prateek
Modified: 2019-03-02 17:21 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prateek 2019-03-01 19:15:18 UTC
11.2-RELEASE-p4

Steps-
1. I have a kernel moduleA that is dependent on other kernel moduleB and if I try to unload moduleA, it returns no error 
2. And if I repeat step 1 it returns device busy error message.
3. Now unload moduleB and it removed successfully
4. Now by default module A is unloaded without giving user any clue.
Comment 1 Conrad Meyer freebsd_committer freebsd_triage 2019-03-01 19:48:12 UTC
This is how module refcounts work.  kldunload just decrements the administrative refcount.  But a module isn't unloaded until all refs drop to zero.

What would you prefer happen?  EBUSY and do not drop the administrative ref if a module has dependencies?
Comment 2 Prateek 2019-03-01 19:53:51 UTC
Thanks for the comment.
Yes, I expect EBUSY and do not drop the administrative ref if a module has dependencies.

Also the error message EBUSY doe snot coem for teh first time and reruuning the same will return EBUSY with dependencies.
Comment 3 Andriy Gapon freebsd_committer freebsd_triage 2019-03-02 17:21:35 UTC
Could you please give an example using real modules, commands and output?