summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2012-07-13 13:39:52 +0200
committerJeremy Allison <jra@samba.org>2012-07-18 15:48:27 -0700
commit56aae9f75455b9882501167de5f3804fec67dca5 (patch)
tree4d91bbd8b4b7ab679872c050740dcccf20f02406 /source3/smbd
parent5d09cec6fe499ac0bcc1ac98fd8aaffe7e43faa3 (diff)
downloadsamba-56aae9f75455b9882501167de5f3804fec67dca5.tar.gz
samba-56aae9f75455b9882501167de5f3804fec67dca5.tar.bz2
samba-56aae9f75455b9882501167de5f3804fec67dca5.zip
s3: Add a _nosync version of smb2_write_complete
This will be used in aio.c to avoid a second fsync after write Signed-off-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/globals.h2
-rw-r--r--source3/smbd/smb2_write.c30
2 files changed, 25 insertions, 7 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index c400181130..4ca9e712df 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -264,6 +264,8 @@ NTSTATUS smbd_smb2_request_process_read(struct smbd_smb2_request *req);
NTSTATUS smb2_read_complete(struct tevent_req *req, ssize_t nread, int err);
NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req);
NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err);
+NTSTATUS smb2_write_complete_nosync(struct tevent_req *req, ssize_t nwritten,
+ int err);
NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req);
NTSTATUS smbd_smb2_request_process_ioctl(struct smbd_smb2_request *req);
NTSTATUS smbd_smb2_request_process_keepalive(struct smbd_smb2_request *req);
diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c
index 6a78939505..9b06b87759 100644
--- a/source3/smbd/smb2_write.c
+++ b/source3/smbd/smb2_write.c
@@ -174,7 +174,9 @@ struct smbd_smb2_write_state {
static void smbd_smb2_write_pipe_done(struct tevent_req *subreq);
-NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err)
+static NTSTATUS smb2_write_complete_internal(struct tevent_req *req,
+ ssize_t nwritten, int err,
+ bool do_sync)
{
NTSTATUS status;
struct smbd_smb2_write_state *state = tevent_req_data(req,
@@ -209,12 +211,14 @@ NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err)
return NT_STATUS_DISK_FULL;
}
- status = sync_file(fsp->conn, fsp, state->write_through);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(5,("smb2: sync_file for %s returned %s\n",
- fsp_str_dbg(fsp),
- nt_errstr(status)));
- return status;
+ if (do_sync) {
+ status = sync_file(fsp->conn, fsp, state->write_through);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(5,("smb2: sync_file for %s returned %s\n",
+ fsp_str_dbg(fsp),
+ nt_errstr(status)));
+ return status;
+ }
}
state->out_count = nwritten;
@@ -222,6 +226,18 @@ NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err)
return NT_STATUS_OK;
}
+NTSTATUS smb2_write_complete(struct tevent_req *req, ssize_t nwritten, int err)
+{
+ return smb2_write_complete_internal(req, nwritten, err, true);
+}
+
+NTSTATUS smb2_write_complete_nosync(struct tevent_req *req, ssize_t nwritten,
+ int err)
+{
+ return smb2_write_complete_internal(req, nwritten, err, false);
+}
+
+
static bool smbd_smb2_write_cancel(struct tevent_req *req)
{
struct smbd_smb2_write_state *state =