new aio engine

Stefan (metze) Metzmacher metze at
Thu Jul 19 01:39:17 MDT 2012

Hi Volker,

> Under
> find a new async I/O engine for Samba. The old one was based
> around the posix aio API, the branch converts it to
> tevent_req.
> It uses a pthread based implementation in by default via
> lib/asys and lib/pthreadpool.
> pthreadpool has a sync fake implementation that works
> without threads.
> The posix api is used in the vfs_aio_posix module for
> in-kernel implementations like FreeBSD and others that might
> be more efficient than a user-space pthreads one.
> The AIO engine is always compiled, HAVE_AIO is reduced to
> the vfs_aio_posix module.
> asys.h has more functions mentioned than actually
> implemented. asys_open is not implemented yet, this will
> require a fork model. I nevertheless want to show the easy
> piece for review early.

It's really good to see this finally in master.

> It has one (at the moment fatal) flaw: If a file is closed
> while async requests are still on the fly, the pread/pwrite
> might end up on the wrong file. Two ways out: Hold back the
> close SMB until all async requests are finished, or put the
> os-level fd on the pending close queue until all the async
> requests are finished. I tend to implement the latter.

I think we should implement asys_cancel() more correct,
which requires a pthreadpool_job_cancel(), which might use
pthread_cancel(). I think that would fix this problem
and it would also be possible to return the correct status
to the smb level read and write.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the samba-technical mailing list