smbd: always flush pending write time update when setting filesize
authorRalph Boehme <slow@samba.org>
Thu, 12 Mar 2020 15:52:34 +0000 (16:52 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 19 Mar 2020 01:20:34 +0000 (01:20 +0000)
commit79d7d6b9d01b8547f16b74a62926d0b471f18c39
tree25e41710b63177f73d70590f9823e4c5cd34b803
parent4e3c2afbd6f12159252405f6efc6528fa9345f08
smbd: always flush pending write time update when setting filesize

We need to flush a pending write time update even when we're setting the
filesize to current filesize.

Note that we're already doing it this way in the relevant places listed my
dochelp@MS in

https://lists.samba.org/archive/cifs-protocol/2019-December/003364.html

  Cleanup (= Close)
  SetBasicInfo
  SetAllocationInfo
  SetEndOfFileInfo
  SetValidDataLengthInfo
  Flush
  FSCTL_SET_ENCRYPTION
  FSCTL_OFFLOAD_WRITE

Cleanup (= Close):

  Already implemented by update_write_time_on_close() and friends.

SetBasicInfo:

  Currently doesn't flush pending updates. Fixed by a subsequent commit.

SetAllocationInfo:

  smb_set_file_allocation_info() when setting a file's allocation size.

SetEndOfFileInfo:

  Currently doesn't flush pending updates. Fixed by a subsequent commit.

SetValidDataLengthInfo:

  Not implemented, returns NT_STATUS_NOT_SUPPORTED which seems wrong btw, as
  SetValidDataLengthInfo IS listed in MS-SMB2 2.2.39.

Flush:

  Currently doesn't flush pending updates. Fixed by subsequent commit.

FSCTL_SET_ENCRYPTION:

  Windows 2016 doesn't flush a pending writetime update, verified with a
  smbtorture test.

FSCTL_OFFLOAD_WRITE:

  NT_STATUS_NOT_IMPLEMENTED

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>
selftest/knownfail.d/samba3.smb2.timestamps
source3/smbd/trans2.c