The Samba-Bugzilla – Attachment 8428 Details for
Bug 9544
vfs_commit does not compile and does not support async write
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
9544.master.patch (text/plain), 5.63 KB, created by
Volker Lendecke
on 2013-01-14 20:56:38 UTC
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Volker Lendecke
Created:
2013-01-14 20:56:38 UTC
Size:
5.63 KB
patch
obsolete
>From 9a1863e64507aed279197633845a54554c00dd93 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Mon, 14 Jan 2013 21:14:20 +0100 >Subject: [PATCH 1/3] smbd: Always compile vfs_commit > >There's no reason not to >--- > source3/configure.in | 1 + > source3/wscript | 1 + > 2 files changed, 2 insertions(+), 0 deletions(-) > >diff --git a/source3/configure.in b/source3/configure.in >index bd3bffe..8228853 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" >diff --git a/source3/wscript b/source3/wscript >index 9a1cd68..a8de357 100644 >--- a/source3/wscript >+++ b/source3/wscript >@@ -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''')) >-- >1.7.3.4 > > >From ba5700b8e931d8afe2ecd9431e0003c5d575f1d9 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Mon, 14 Jan 2013 21:36:51 +0100 >Subject: [PATCH 2/3] smbd: Fix bug 9544, part 1 > >Adapt the sync function names >--- > source3/modules/vfs_commit.c | 6 +++--- > 1 files changed, 3 insertions(+), 3 deletions(-) > >diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c >index 865250a..c9c0a05 100644 >--- a/source3/modules/vfs_commit.c >+++ b/source3/modules/vfs_commit.c >@@ -307,10 +307,10 @@ 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, > .connect_fn = commit_connect, >- .ftruncate = commit_ftruncate >+ .ftruncate_fn = commit_ftruncate > }; > > NTSTATUS vfs_commit_init(void); >-- >1.7.3.4 > > >From acb00c81a6f6f66d345aa4ea66219d61623590c2 Mon Sep 17 00:00:00 2001 >From: Volker Lendecke <vl@samba.org> >Date: Mon, 14 Jan 2013 21:37:52 +0100 >Subject: [PATCH 3/3] smbd: Fix bug 9544, part 2 > >Plug in async pwrite >--- > source3/modules/vfs_commit.c | 80 ++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 80 insertions(+), 0 deletions(-) > >diff --git a/source3/modules/vfs_commit.c b/source3/modules/vfs_commit.c >index c9c0a05..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) >@@ -309,6 +387,8 @@ static struct vfs_fn_pointers vfs_commit_fns = { > .close_fn = commit_close, > .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_fn = commit_ftruncate > }; >-- >1.7.3.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
jra
:
review+
Actions:
View
Attachments on
bug 9544
: 8428