USB stack getting confused

Hans Petter Selasky hps at selasky.org
Sun Mar 10 13:10:51 UTC 2019


On 3/10/19 11:26 AM, Konstantin Belousov wrote:
> 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.
> 

Can you try the attached patch?

--HPS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: usb.diff
Type: text/x-patch
Size: 1936 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20190310/2bdf5284/attachment.bin>


More information about the freebsd-hackers mailing list