X-Git-Url: http://git.samba.org/?a=blobdiff_plain;f=source3%2Fmodules%2Fvfs_aio_pthread.c;h=4525beb818121dfeb8458ed146754c0f9dfe759d;hb=cb405947caa9f4bdb962483860a9093a364ecbf2;hp=d62af572561afbb9a3281dc7c8f390d44e1e0599;hpb=622eb59eb472bbdb9fd985c4d8880d3a1c098cd7;p=mat%2Fsamba.git diff --git a/source3/modules/vfs_aio_pthread.c b/source3/modules/vfs_aio_pthread.c index d62af57256..4525beb818 100644 --- a/source3/modules/vfs_aio_pthread.c +++ b/source3/modules/vfs_aio_pthread.c @@ -40,6 +40,7 @@ struct aio_private_data { int ret_errno; bool cancelled; bool write_command; + bool flush_write; }; /* List of outstanding requests we have. */ @@ -115,6 +116,14 @@ static void aio_worker(void *private_data) (const void *)pd->aiocb->aio_buf, pd->aiocb->aio_nbytes); } + if (pd->ret_size != -1 && pd->flush_write) { + /* + * Optimization - flush if requested. + * Ignore error as upper layer will + * also do this. + */ + (void)fsync(pd->aiocb->aio_fildes); + } } else { pd->ret_size = sys_pread(pd->aiocb->aio_fildes, (void *)pd->aiocb->aio_buf, @@ -229,6 +238,12 @@ static int aio_pthread_write(struct vfs_handle_struct *handle, } pd->write_command = true; + if (lp_strict_sync(SNUM(fsp->conn)) && + (lp_syncalways(SNUM(fsp->conn)) || + aio_write_through_requested(aio_ex))) { + pd->flush_write = true; + } + ret = pthreadpool_add_job(pool, pd->jobid, aio_worker, (void *)pd); if (ret) {