int ret_errno;
bool cancelled;
bool write_command;
+ bool flush_write;
};
/* List of outstanding requests we have. */
(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,
}
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) {
int (*handle_completion)(struct aio_extra *ex, int errcode);
};
+/****************************************************************************
+ Accessor function to return write_through state.
+*****************************************************************************/
+
+bool aio_write_through_requested(struct aio_extra *aio_ex)
+{
+ return aio_ex->write_through;
+}
+
/****************************************************************************
Initialize the signal handler for aio read/write.
*****************************************************************************/
/* The following definitions come from smbd/aio.c */
+bool aio_write_through_requested(struct aio_extra *aio_ex);
bool initialize_async_io_handler(void);
NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
struct smb_request *req,