Using threads (pthreads) in a VFS module on Linux
Richard Sharpe
realrichardsharpe at gmail.com
Sat Sep 29 14:45:45 MDT 2012
Hi,
At Samba XP during my presentation on the Samba VFS someone asked me
about whether or not you can really use threads in a VFS Module.
At that time I blithely answered yes. While the answer is true, in my
experience, at least for Linux, it is a little more complicated than
that.
If you use AIO, you should be aware that it uses signals. If you do
not disable the signals that Samba uses in your threads you risk nasty
things happening. For example, IO completions can silently disappear
if you have multiple outstanding AIO requests at any one time, which
after all, is the raison d'être of AIO. Windows does not like it when
it does not get a response for some IOs for a long period of time and
simply resets the connection.
The solution is to use pthread_sigmask and friends to switch off all
signals, or at least the ones Samba wants, before starting your
threads.
--
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
More information about the samba-technical
mailing list