tech-kern archive

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

Re: open() and close() from multithread application



> On 7. Mar 2026, at 18:59, Beesdeckar <beesdeckar%softinengines.com@localhost> wrote:
> 
> Hello,
> 
> I have application with three threads, second and third threads are created with pthread_create().
> In kernel module my d_open and d_close handlers contains reference count incrementing in d_open and decrementing in d_close handler.
> All is right in several first sequences open(), ioctl(), close() .
> These sequences can be called from all three threads simultaneously.
> After some time module comes to state that d_close is never reached when called close(), I checked close() in user-mode debugger and it returns always 0.
> I am sure that d_close is not called I don't see my printf() output,
> but I see all another d_open calls, and when checked my reference count
> it is on every d_open incremented and never decremented.
> 
> What to investigate to find why d_close handler is not called ?
> I use kernel with enabled DIAGNOSTIC, DEBUG, LOCKDEBUG.

Suppose d_open() gets called on every open while d_close() only gets called on last close.

--
J. Hannken-Illjes - hannken%mailbox.org@localhost


Home | Main Index | Thread Index | Old Index