[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Wed Jan 16 03:49:04 MST 2013


The branch, v4-0-test has been updated
       via  a950974 configure: Fix bug 9546, aio_suspend detection on FreeBSD
       via  c5495c3 smbd: Fix bug 9544, part 2
       via  787ba45 smbd: Fix bug 9544, part 1
       via  aa32e49 smbd: Always compile vfs_commit
      from  46473b4 Fix bug 9548: Correctly detect O_DIRECT

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit a95097414e453e05cbe535c42cc335c597283c8e
Author: Volker Lendecke <vl at 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
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Wed Jan 16 11:48:16 CET 2013 on sn-devel-104

commit c5495c30fa197909724ce2b3e05e941889234751
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 14 21:37:52 2013 +0100

    smbd: Fix bug 9544, part 2
    
    Plug in async pwrite

commit 787ba4532c7c814026824c60d4bd83d6d3a7b4d3
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 14 21:36:51 2013 +0100

    smbd: Fix bug 9544, part 1
    
    Adapt the sync function names

commit aa32e4924b3549383d9f060fb93fe569b3c05bbd
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Jan 14 21:14:20 2013 +0100

    smbd: Always compile vfs_commit
    
    There's no reason not to

-----------------------------------------------------------------------

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 93c3d1b..e719b53 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"
@@ -5391,7 +5392,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 7a91092..5ee2cca 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -475,7 +475,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:
@@ -1694,6 +1694,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


More information about the samba-cvs mailing list