Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/opencrypto



   Date: Sun, 26 Jan 2014 11:36:32 +0000
   From: David Laight <david%l8s.co.uk@localhost>

   It also sounds like manual unloads of drivers can happen when the
   device is open - and that is also bad.
   A manual unload probably isn't going to race with open or close though.

   Disallowing unload completely would be a pain when developing drivers.

It seems to me that the crux of the problem is that devsw_detach
doesn't fail if the device is still in use, because we do keep no
books about which devsws are still in use, so there's nothing to stop
you from unloading a device's module before you've given a its close
routine a chance to clean up.

Would it suffice to add an open count to struct bdevsw and struct
cdevsw, to be maintained by {bdev,cdev}_{open,close}?

FreeBSD has a fancier reference-counting API for their devsw, but I'm
not sure why they need that.


A lesser problem is that the steps to finalize a device driver module
are complicated (attach/detach the devsw, the cfdriver, the cfattach,
the cfdata) and different drivers do them in a different order and may
or may not back out the same way (e.g., dtv(4) ignores devsw_detach
failure), so we ought to formalize what the right way to do this is
once we have a way that can work.


Home | Main Index | Thread Index | Old Index