1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-29 13:49:30 +03:00

smbd: flush pending writetime update when flushing file

Cf the explanations in the previous commit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme
2020-03-12 19:23:40 +01:00
committed by Jeremy Allison
parent 79d7d6b9d0
commit d99d5bf2c6
3 changed files with 14 additions and 1 deletions

View File

@ -1,2 +1 @@
^samba3.smb2.timestamps.delayed-write-vs-flush\(.*\)$
^samba3.smb2.timestamps.delayed-write-vs-setbasic\(.*\)$

View File

@ -5714,6 +5714,10 @@ static struct files_struct *file_sync_one_fn(struct files_struct *fsp,
}
sync_file(conn, fsp, True /* write through */);
if (fsp->modified) {
trigger_write_time_update_immediate(fsp);
}
return NULL;
}
@ -5752,6 +5756,9 @@ void reply_flush(struct smb_request *req)
END_PROFILE(SMBflush);
return;
}
if (fsp->modified) {
trigger_write_time_update_immediate(fsp);
}
}
reply_outbuf(req, 0, 0);

View File

@ -112,6 +112,7 @@ static void smbd_smb2_request_flush_done(struct tevent_req *subreq)
struct smbd_smb2_flush_state {
struct smbd_smb2_request *smb2req;
struct files_struct *fsp;
};
static void smbd_smb2_flush_done(struct tevent_req *subreq);
@ -132,6 +133,7 @@ static struct tevent_req *smbd_smb2_flush_send(TALLOC_CTX *mem_ctx,
return NULL;
}
state->smb2req = smb2req;
state->fsp = fsp;
DEBUG(10,("smbd_smb2_flush: %s - %s\n",
fsp_str_dbg(fsp), fsp_fnum_dbg(fsp)));
@ -207,6 +209,8 @@ static void smbd_smb2_flush_done(struct tevent_req *subreq)
{
struct tevent_req *req = tevent_req_callback_data(
subreq, struct tevent_req);
struct smbd_smb2_flush_state *state = tevent_req_data(
req, struct smbd_smb2_flush_state);
int ret;
struct vfs_aio_state vfs_aio_state;
@ -216,6 +220,9 @@ static void smbd_smb2_flush_done(struct tevent_req *subreq)
tevent_req_nterror(req, map_nt_error_from_unix(vfs_aio_state.error));
return;
}
if (state->fsp->modified) {
trigger_write_time_update_immediate(state->fsp);
}
tevent_req_done(req);
}