freebsd-src
freebsd-src copied to clipboard
nmdm: Allow module to be force-unloaded.
If an nmdm device was created by accident such as by running
ls /dev/nmdmAA, it would restrict the module from being unloaded,
despite no data passing through it.
With this patch, kldunload nmdm will still fail if any nmdm device still
exists.
kldunload -f nmdm will try to destroy all nmdm devices before unloading.
If an nmdm modem is either opened in blocking mode or data is being
passed through it, after five seconds of trying, it will not be destroyed
and the unload will also fail.
Likewise, fix an incorrect tty_lock, a typo, and the order of locking.
Some problems with the locking bits, and IMO the other half is working around a bug. I don't see where the current implementation would be intentionally stopping destruction of a nmdm pair that was only ever half open.
Ah, right- we clone it in response to stat(), nothing actually opened it or ever planned on opening it. Hmm.
@kevans91 Looks like this is ready for you to re-review since it looks like your feedback has been applied.
The remaining recommendation "Ideally, I think we'd have some kind of tty_drain_freed -> destroy_dev_drain_pending -> taskqueue_drain" is not done yet: I have not had time yet to try this.
any update?
looks like changes are still needed... any upate?
last pinged over 6 months ago, with no update. Closing. Feel free to re-open this or to create a new pull request if the required changes are made. Thanks for your submission. Sorry that it didn't make it in. But we're open to having a fixed version.
Unfortunately, I never got time to make the changes requested ("without the timeout by adding some plumbing through the tty layer to drain the deferred destroy_dev taskqueue").
Perhaps a freebsd bug report should be made for this, though.