open() and close() from multithread application
Beesdeckar <[email protected]> Sat, 7 Mar 2026 18:59:36 +0100
| Newsgroups | gmane.os.netbsd.devel.kernel |
|---|---|
| Organization | Soft in Engines |
| Message-ID | <[email protected]> |
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.