summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 =