mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
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>
This commit is contained in:
parent
5d09cec6fe
commit
56aae9f754
@ -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);
|
||||
|
@ -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 =
|
||||
|
Loading…
x
Reference in New Issue
Block a user