diff options
author | Ralph Boehme <slow@samba.org> | 2020-03-12 19:23:40 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2020-03-19 01:20:34 +0000 |
commit | d99d5bf2c6d0a818ef2f3920e0c93fac38761c36 (patch) | |
tree | fa70b13864d024f0ac39fd0a8abc0765ca097391 | |
parent | 79d7d6b9d01b8547f16b74a62926d0b471f18c39 (diff) | |
download | samba-d99d5bf2c6d0a818ef2f3920e0c93fac38761c36.tar.gz |
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>
-rw-r--r-- | selftest/knownfail.d/samba3.smb2.timestamps | 1 | ||||
-rw-r--r-- | source3/smbd/reply.c | 7 | ||||
-rw-r--r-- | source3/smbd/smb2_flush.c | 7 |
3 files changed, 14 insertions, 1 deletions
diff --git a/selftest/knownfail.d/samba3.smb2.timestamps b/selftest/knownfail.d/samba3.smb2.timestamps index c7d0ff2849e..8a52d4a2ad6 100644 --- a/selftest/knownfail.d/samba3.smb2.timestamps +++ b/selftest/knownfail.d/samba3.smb2.timestamps @@ -1,2 +1 @@ -^samba3.smb2.timestamps.delayed-write-vs-flush\(.*\)$ ^samba3.smb2.timestamps.delayed-write-vs-setbasic\(.*\)$ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index be7c170cd1f..f809837f1cb 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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); diff --git a/source3/smbd/smb2_flush.c b/source3/smbd/smb2_flush.c index 86d5bbc58f0..08539e95807 100644 --- a/source3/smbd/smb2_flush.c +++ b/source3/smbd/smb2_flush.c @@ -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); } |