summaryrefslogtreecommitdiffstats
path: root/source3/smbd/smb2_write.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-06-10 13:20:37 -0700
committerJeremy Allison <jra@samba.org>2010-06-10 13:20:37 -0700
commit321d7a6303b651cc2533f4b72dc7cef6b7d64da4 (patch)
tree6f5a24f98802ceaa5eded1dd7d1bfe2288f5520b /source3/smbd/smb2_write.c
parentedd8940e1864deedaf0f6484809def586ac215f2 (diff)
downloadsamba-321d7a6303b651cc2533f4b72dc7cef6b7d64da4.tar.gz
samba-321d7a6303b651cc2533f4b72dc7cef6b7d64da4.tar.xz
samba-321d7a6303b651cc2533f4b72dc7cef6b7d64da4.zip
Implement AIO in SMB2. Doesn't allow cancel calls yet (to be added).
Jeremy.
Diffstat (limited to 'source3/smbd/smb2_write.c')
-rw-r--r--source3/smbd/smb2_write.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c
index 58aeee5a825..7db0e7e6a56 100644
--- a/source3/smbd/smb2_write.c
+++ b/source3/smbd/smb2_write.c
@@ -298,6 +298,34 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}
+ /* Try and do an asynchronous write. */
+ status = schedule_aio_smb2_write(conn,
+ smbreq,
+ fsp,
+ in_offset,
+ in_data,
+ state->write_through);
+
+ if (NT_STATUS_IS_OK(status)) {
+ /*
+ * Doing an async write. Don't
+ * send a "gone async" message
+ * as we expect this to be less
+ * than the client timeout period.
+ * JRA. FIXME for offline files..
+ * FIXME - add cancel code..
+ */
+ smb2req->async = true;
+ return req;
+ }
+
+ if (!NT_STATUS_EQUAL(status, NT_STATUS_RETRY)) {
+ /* Real error in setting up aio. Fail. */
+ tevent_req_nterror(req, NT_STATUS_FILE_CLOSED);
+ return tevent_req_post(req, ev);
+ }
+
+ /* Fallback to synchronous. */
init_strict_lock_struct(fsp,
in_file_id_volatile,
in_offset,