USB stack getting confused
Konstantin Belousov
kostikbel at gmail.com
Sun Mar 10 10:26:53 UTC 2019
On Sun, Mar 10, 2019 at 11:18:36AM +0100, Hans Petter Selasky wrote:
> On 3/10/19 10:47 AM, Konstantin Belousov wrote:
> >> Yes, I can do that if destroy_dev() ensures that d_close is called for
> >> all open file handles once and only once before it returns. I think this
> >> is where the problem comes from.
> > See above. For d_close it is impossible, for cdevpriv dtr it is already
> > there by design.
> >
>
> Yes, cdevpriv_dtr will wait for the final close() from user-space
> unfortunately. Or am I mistaken?
You are mistaken. Cdevpriv destructors are called either on the file close
(not the last close in d_close sense, just file close) OR during destroy_dev().
Each destructor/file pair is called exactly once, regardless of the cause.
More information about the freebsd-hackers
mailing list