[PATCH] Enhance time sampling of async IO VFS functions

Jeremy Allison jra at samba.org
Fri Feb 26 17:12:05 UTC 2016


On Fri, Feb 26, 2016 at 03:33:42PM +0100, Ralph Boehme wrote:
> Hi!
> 
> The problem:
> 
> when using vfs_time_audit to log slow VFS functions, a blocking sync
> operation will cause previously sheduled async IO operations to
> accumulate the penalty from the blocking sync operation. Example:
> 
> 1. SMB2 read request received, added to the async queue
> 
> 2. SMB2 create_file request comes in, is processed and blocks
> 
> 3. async read completes in the dispatcher thread, completion callback
>    will be called when we enter the main tevent loop
> 
> 4. open() completes after N seconds
> 
> 5. main tevent event loop is entered, async results are processed
> 
> 6. async read result is processed, time sampling will include the N
>    seconds blocked in open()
> 
> Fixing this involves adding time sampling to all async IO "backends"
> (libasys, used in vfs_default, and all VFS modules that do their own
> async IO, so glusterfs, aio_fork and aio_linux) and passing the time
> sample up the VFS stack.
> 
> For passing it up the VFS stack I need to stick an additional arg to
> all $IO_recv() VFS functions, which is cumbersome but the only way I
> see to get this through.

I like what you're trying to do but I *hate* adding the extra
arg to the VFS functions. Can we think of any other way to do
this ?

As all these functions take a tevent_req pointer can't you
do something clever with using the talloc hierarchy to pass
up the extra data ?

Hmmm. Looks to me like adding:

_PUBLIC_ void *talloc_find_child_byname(const void *context, const char *name)

would be a great addition to talloc for this :-).



More information about the samba-technical mailing list