Re: kernel threads and close method in a device driver

David Woodhouse (dwmw2@infradead.org)
Wed, 18 Apr 2001 00:32:48 +0100


mleisner@eng.mc.xerox.com said:
> The architecture is currently:
> open device
> do IOCTL (spinning a kernel thread and doing initialization)
> There is currently an IOCTL which short-circuits to the close method.
> Turns out it seems necessary to do this IOCTL -- close never gets
> invoked.

Your kernel thread is probably sharing filedescriptors with the parent
process, so although your application closes its copy, because the kernel
thread hasn't closed its copy, the ->release() method never gets called.

Make sure you're cleaning up properly when starting the kernel thread. See
how other kernel threads do it. As Andi says, daemonize() is a good start,
although it's not always sufficient.

--
dwmw2

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/