The branch, master has been updated via a82db92 smbd: Fix bug 9544, part 2 via 2154272 smbd: Fix bug 9544, part 1 via 0bafce0 smbd: Always compile vfs_commit via 584402a configure: Fix bug 9546, aio_suspend detection on FreeBSD from e0bfb59 Fix bug 9548: Correctly detect O_DIRECT
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit a82db92a8a68f6e33e20fd2b55401225d91345cf Author: Volker Lendecke <v...@samba.org> Date: Mon Jan 14 21:37:52 2013 +0100 smbd: Fix bug 9544, part 2 Plug in async pwrite Reviewed by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Jan 15 00:55:51 CET 2013 on sn-devel-104 commit 215427202ad993ad48d0ea4c47ac4435fc4610fb Author: Volker Lendecke <v...@samba.org> Date: Mon Jan 14 21:36:51 2013 +0100 smbd: Fix bug 9544, part 1 Adapt the sync function names Reviewed by: Jeremy Allison <j...@samba.org> commit 0bafce02f80af8c7d1fb0c6b210353925a3f4c39 Author: Volker Lendecke <v...@samba.org> Date: Mon Jan 14 21:14:20 2013 +0100 smbd: Always compile vfs_commit There's no reason not to Reviewed by: Jeremy Allison <j...@samba.org> commit 584402a71a4dd4bc821a58087814a1f3c110bb65 Author: Volker Lendecke <v...@samba.org> Date: Mon Jan 7 12:53:27 2013 -0800 configure: Fix bug 9546, aio_suspend detection on FreeBSD NULL is not defined without some includes Reviewed by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: source3/configure.in | 3 +- source3/modules/vfs_commit.c | 86 ++++++++++++++++++++++++++++++++++++++++- source3/wscript | 3 +- 3 files changed, 87 insertions(+), 5 deletions(-) Changeset truncated at 500 lines: diff --git a/source3/configure.in b/source3/configure.in index 3591131..b17a37e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -459,6 +459,7 @@ default_shared_modules="$default_shared_modules vfs_crossrename" default_shared_modules="$default_shared_modules vfs_linux_xfs_sgid" default_shared_modules="$default_shared_modules vfs_time_audit" default_shared_modules="$default_shared_modules vfs_media_harmony" +default_shared_modules="$default_shared_modules vfs_commit" default_shared_modules="$default_shared_modules idmap_autorid" default_shared_modules="$default_shared_modules idmap_tdb2" default_shared_modules="$default_shared_modules idmap_rid" @@ -5386,7 +5387,7 @@ int main() { struct aiocb a; return aio_cancel(1, &a); }])], AC_MSG_CHECKING(for aio_suspend) AC_LINK_IFELSE([AC_LANG_SOURCE([#include <aio.h> -int main() { struct aiocb a; return aio_suspend(&a, 1, NULL); }])], +int main() { struct aiocb a; struct timespec t; return aio_suspend(&a, 1, &t); }])], [AC_DEFINE(HAVE_AIO_SUSPEND, 1, [Have aio_suspend]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) else diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c index 865250a..a6bc2a4 100644 --- a/source3/modules/vfs_commit.c +++ b/source3/modules/vfs_commit.c @@ -19,6 +19,7 @@ #include "includes.h" #include "system/filesys.h" #include "smbd/smbd.h" +#include "lib/util/tevent_unix.h" /* Commit data module. * @@ -275,6 +276,83 @@ static ssize_t commit_pwrite( return ret; } +struct commit_pwrite_state { + struct vfs_handle_struct *handle; + struct files_struct *fsp; + ssize_t ret; + int err; +}; + +static void commit_pwrite_written(struct tevent_req *subreq); + +static struct tevent_req *commit_pwrite_send(struct vfs_handle_struct *handle, + TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + struct files_struct *fsp, + const void *data, + size_t n, off_t offset) +{ + struct tevent_req *req, *subreq; + struct commit_pwrite_state *state; + + req = tevent_req_create(mem_ctx, &state, struct commit_pwrite_state); + if (req == NULL) { + return NULL; + } + state->handle = handle; + state->fsp = fsp; + + subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data, + n, offset); + if (tevent_req_nomem(subreq, req)) { + return tevent_req_post(req, ev); + } + tevent_req_set_callback(subreq, commit_pwrite_written, req); + return req; +} + +static void commit_pwrite_written(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct commit_pwrite_state *state = tevent_req_data( + req, struct commit_pwrite_state); + int commit_ret; + + state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err); + TALLOC_FREE(subreq); + + if (state->ret <= 0) { + tevent_req_done(req); + return; + } + + /* + * Ok, this is a sync fake. We should make the sync async as well, but + * I'm too lazy for that right now -- vl + */ + commit_ret = commit(state->handle, state->fsp, state->fsp->fh->pos, + state->ret); + + if (commit_ret == -1) { + state->ret = -1; + } + + tevent_req_done(req); +} + +static ssize_t commit_pwrite_recv(struct tevent_req *req, int *err) +{ + struct commit_pwrite_state *state = + tevent_req_data(req, struct commit_pwrite_state); + + if (tevent_req_is_unix_error(req, err)) { + return -1; + } + *err = state->err; + return state->ret; +} + static int commit_close( vfs_handle_struct * handle, files_struct * fsp) @@ -307,10 +385,12 @@ static int commit_ftruncate( static struct vfs_fn_pointers vfs_commit_fns = { .open_fn = commit_open, .close_fn = commit_close, - .write = commit_write, - .pwrite = commit_pwrite, + .write_fn = commit_write, + .pwrite_fn = commit_pwrite, + .pwrite_send_fn = commit_pwrite_send, + .pwrite_recv_fn = commit_pwrite_recv, .connect_fn = commit_connect, - .ftruncate = commit_ftruncate + .ftruncate_fn = commit_ftruncate }; NTSTATUS vfs_commit_init(void); diff --git a/source3/wscript b/source3/wscript index 5078716..bb5ee89 100644 --- a/source3/wscript +++ b/source3/wscript @@ -471,7 +471,7 @@ return acl_get_perm_np(permset_d, perm); conf.CHECK_CODE('struct aiocb a; return aio_return(&a);', 'HAVE_AIO_RETURN', msg='Checking for aio_return', headers='aio.h', lib='aio rt') conf.CHECK_CODE('struct aiocb a; return aio_error(&a);', 'HAVE_AIO_ERROR', msg='Checking for aio_error', headers='aio.h', lib='aio rt') conf.CHECK_CODE('struct aiocb a; return aio_cancel(1, &a);', 'HAVE_AIO_CANCEL', msg='Checking for aio_cancel', headers='aio.h', lib='aio rt') - conf.CHECK_CODE('struct aiocb a; return aio_suspend(&a, 1, NULL);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h', lib='aio rt') + conf.CHECK_CODE('struct aiocb a; struct timespec t; return aio_suspend(&a, 1, &t);', 'HAVE_AIO_SUSPEND', msg='Checking for aio_suspend', headers='aio.h', lib='aio rt') if not conf.CONFIG_SET('HAVE_AIO'): conf.DEFINE('HAVE_NO_AIO', '1') else: @@ -1690,6 +1690,7 @@ main() { vfs_streams_xattr vfs_streams_depot vfs_acl_xattr vfs_acl_tdb vfs_smb_traffic_analyzer vfs_preopen vfs_catia vfs_scannedonly vfs_media_harmony + vfs_commit vfs_crossrename vfs_linux_xfs_sgid vfs_time_audit idmap_autorid idmap_tdb2 idmap_rid idmap_hash''')) -- Samba Shared Repository