Using threads (pthreads) in a VFS module on Linux

Volker Lendecke Volker.Lendecke at SerNet.DE
Sat Sep 29 13:31:02 MDT 2012

On Sat, Sep 29, 2012 at 01:45:45PM -0700, Richard Sharpe wrote:
> 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.

Please be aware that neither aio_fork nor aio_pthread (now
the default) use signals. The Posix API is now done in the
aio_posix module. Please also be aware that our internal
messaging system uses SIGUSR1, but this use might possibly
go away relatively soon (not for 4.0 though).


SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen, mailto:kontakt at

More information about the samba-technical mailing list