From: Ralph Boehme Date: Thu, 12 Mar 2020 18:23:40 +0000 (+0100) Subject: smbd: flush pending writetime update when setting timestamps file X-Git-Tag: ldb-2.2.0~1397 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b90fe69a865ae8648b6548eabbcf2fa8237ebd8;p=thirdparty%2Fsamba.git smbd: flush pending writetime update when setting timestamps file Cf the explanations in the previous commits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14150 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/selftest/knownfail.d/samba3.smb2.timestamps b/selftest/knownfail.d/samba3.smb2.timestamps deleted file mode 100644 index 8a52d4a2ad6..00000000000 --- a/selftest/knownfail.d/samba3.smb2.timestamps +++ /dev/null @@ -1 +0,0 @@ -^samba3.smb2.timestamps.delayed-write-vs-setbasic\(.*\)$ diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index f809837f1cb..5e2c2669310 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -9437,6 +9437,10 @@ void reply_setattrE(struct smb_request *req) goto out; } + if (fsp->modified) { + trigger_write_time_update_immediate(fsp); + } + DEBUG( 3, ( "reply_setattrE %s actime=%u modtime=%u " " createtime=%u\n", fsp_fnum_dbg(fsp), diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 8000e1ae924..5b7333773bb 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -7836,8 +7836,15 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn, DEBUG(10, ("smb_set_file_basic_info: file %s\n", smb_fname_str_dbg(smb_fname))); - return smb_set_file_time(conn, fsp, smb_fname, &ft, - true); + status = smb_set_file_time(conn, fsp, smb_fname, &ft, true); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (fsp != NULL && fsp->modified) { + trigger_write_time_update_immediate(fsp); + } + return NT_STATUS_OK; } /**************************************************************************** @@ -7874,11 +7881,15 @@ static NTSTATUS smb_set_info_standard(connection_struct *conn, return status; } - return smb_set_file_time(conn, - fsp, - smb_fname, - &ft, - true); + status = smb_set_file_time(conn, fsp, smb_fname, &ft, true); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (fsp != NULL && fsp->modified) { + trigger_write_time_update_immediate(fsp); + } + return NT_STATUS_OK; } /****************************************************************************