The branch, master has been updated
via b6c8d5d8291 smbd: implement modern write time update logic
via 0635966c325 smbtorture: add
"smb2.timestamps.modern_write_time_update-2"
via b78202327fa smbtorture: add
"smb2.timestamps.modern_write_time_update-1"
via bed764ac805 smbtorture: add
"base.delaywrite.modern_write_time_update-1"
via 76899e3c0c0 smbtorture: adjust "smb2.timestamps.delayed-2write" for
modern SMB delayed write
via 28804006da4 smbtorture: adjust
"smb2.timestamps.delayed-write-vs-setbasic" for modern SMB delayed write
via 47075041d85 smbtorture: adjust
"smb2.timestamps.delayed-write-vs-flush" for modern SMB delayed write
via e118fe5e8b2 smbtorture: adjust
"smb2.timestamps.delayed-write-vs-seteof" for modern SMB delayed write
via 6bc1ffe8d57 smbtorture: adjust "base.delaywrite.delayed update of
write time 6" for modern SMB delayed write
via f5faa524a05 smbtorture: adjust "base.delaywrite.delayed update of
write time 5b" for modern SMB delayed write
via 165e9670280 smbtorture: adjust "base.delaywrite.delayed update of
write time 5" for modern SMB delayed write
via f54b9330e13 smbtorture: adjust "base.delaywrite.delayed update of
write time 4" for modern SMB delayed write
via 86cb56eda68 smbtorture: adjust "base.delaywrite.delayed update of
write time 3c" for modern SMB delayed write
via 141b2ef2769 smbtorture: adjust "base.delaywrite.delayed update of
write time 3b" for modern SMB delayed write
via 83dba3cabc2 smbtorture: adjust "base.delaywrite.delayed update of
write time 3a" for modern SMB delayed write
via 1e7d56338a3 smbtorture: adjust "base.delaywrite.delayed update of
write time 3" for modern SMB delayed write
via f64c25c1a9b smbtorture: adjust "base.delaywrite.delayed update of
write time using 2 connections" for modern SMB delayed write
via 44446d7c556 smbtorture: adjust "base.delaywrite.update of write
time using SET_ALLOCATION_SIZE" for modern SMB delayed write
via 344ec3971ae smbtorture: adjust "base.delaywrite.update of write
time using SET_END_OF_FILE" for modern SMB delayed write
via d75abdc3049 smbtorture: adjust "base.delaywrite.update of write
time and SMBwrite truncate expand" for modern SMB delayed write
via 5bf3a516cab smbtorture: adjust "base.delaywrite.update of write
time and SMBwrite truncate" for modern SMB delayed write
via e60596f48d7 smbtorture: adjust "base.delaywrite.delayed update of
write time" for modern SMB delayed write
via 1a02a9ebabe smbtorture: adjust "base.delaywrite.finfo update on
close" for modern SMB delayed write
via 43ed3456d9b smbtorture: change variable name in SET_INFO_FILE_EX
macro
via 24ae9d6a720 smbtorture: whitespace in test_delayed_write_update2()
via e2ed11e0f7a libtorture: add torture_assert_nttime_not_equal[_goto]()
via 907f17dda99 smbd: remove get_change_timespec()
via 560c7359ced smbd: check allocsize change request against current
allocsize
from e60f6415584 manpages:smb.conf: disable roaming profiles with 'logon
path ='
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b6c8d5d82917b2601b566039dbfc6cad045c917a
Author: Ralph Boehme <[email protected]>
Date: Mon Mar 10 16:31:13 2025 +0100
smbd: implement modern write time update logic
The gist of this is:
1. A write or other modifications as per MS-FSA "2.1.4.17 Algorithm for
Noting
that a File Has Been Modified" immediately update the file times, there's no
delayed update.
2. Setting a timestamp on a handle only disables further timestamp updates
via
that handle. Modifications via other handles must still update the
timestamps.
This can not be implemented by storing the sticky writetime in the
share_mode_data record for performance reasons, as from 2 it follows that
the
record would have to be checked and updated for every write on all handles.
Instead, writes on handles with sticky writetime in effect, record the
current
timestamp before the modification and reset the filesystem timestamp to the
recorded value after doing the modification.
For reference, these are the relevant pieces from MS-FSA:
2.1.1.6 Abstract Date Model: Per Open
- UserSetModificationTime: A Boolean that is TRUE if a user has explicitly
set
File.LastModificationTime through this Open.
- UserSetChangeTime: A Boolean that is TRUE if a user has explicitly set
File.LastChangeTime through this Open.
- UserSetAccessTime: A Boolean that is TRUE if a user has explicitly set
File.LastAccessTime through this Open.
2.1.4.17 Algorithm for Noting That a File Has Been Modified
The inputs for this algorithm are as follows:
- Open: The Open through which the file was modified.
The pseudocode for the algorithm is as follows:
The object store SHOULD<43>:
- If Open.UserSetModificationTime is FALSE, set
Open.File.LastModificationTime
to the current system time.
- If Open.UserSetChangeTime is FALSE, set Open.File.LastChangeTime to the
current system time.
- If Open.UserSetAccessTime is FALSE, set Open.File.LastAccessTime to the
current system time.
- Set Open.File.FileAttributes.FILE_ATTRIBUTE_ARCHIVE to TRUE.
This then gets used for eg writes:
2.1.5.4 Server Requests a Write
...
- The object store MUST note that the file has been modified as specified in
section 2.1.4.17 with Open equal to Open.
...
Note the following differences between Windows behaviour and current
MS-FSA, these are documentation bugs that will be fixed in later
releases as discussed here:
https://lists.samba.org/archive/cifs-protocol/2025-March/004453.html
* When processing FileEndOfFileInformation timestamps must be updated
if new size equals current size
* When processing FileAllocationInformation timestamps must be updated
if new size equals current size
* When processing FileAllocationInformation,
If (the new allocation size is less than the existing allocation)
Set the modification time (which will also updates the change time)
Else
Update the LastChangeTime
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
Autobuild-User(master): Ralph Böhme <[email protected]>
Autobuild-Date(master): Thu Mar 27 06:37:31 UTC 2025 on atb-devel-224
commit 0635966c325efd751ef9dbe12186998e1e28a28d
Author: Ralph Boehme <[email protected]>
Date: Mon Mar 10 19:03:42 2025 +0100
smbtorture: add "smb2.timestamps.modern_write_time_update-2"
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit b78202327fad0b9e2fb23d1aa383e6954757db81
Author: Ralph Boehme <[email protected]>
Date: Mon Mar 3 16:36:24 2025 +0100
smbtorture: add "smb2.timestamps.modern_write_time_update-1"
This checks for modern Windows timestamp update behaviour over
SMB2. Same as "base.delaywrite.modern_write_time_update-1" but for
SMB2.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit bed764ac8059823b9a0d6f19e3e4990594f86017
Author: Ralph Boehme <[email protected]>
Date: Thu Mar 6 12:01:20 2025 +0100
smbtorture: add "base.delaywrite.modern_write_time_update-1"
The test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 76899e3c0c0dd5e73219bf3d1ff1f0eec67af052
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "smb2.timestamps.delayed-2write" for modern SMB delayed
write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 28804006da477c6ce30a8cd839ad6ec5ecf49a35
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "smb2.timestamps.delayed-write-vs-setbasic" for modern
SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 47075041d85500dee7315d12d8d5a034414f2f16
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "smb2.timestamps.delayed-write-vs-flush" for modern SMB
delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit e118fe5e8b228d0e2fdb945d18d0e0570b8d3476
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "smb2.timestamps.delayed-write-vs-seteof" for modern SMB
delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 6bc1ffe8d57927eb9ff2a0b95caf973866b6bbae
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 6" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit f5faa524a05f91c13dbfbb5dc54d54277f400743
Author: Ralph Boehme <[email protected]>
Date: Thu Mar 6 18:48:59 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 5b" for
modern SMB delayed write
No need to run the loops for so long with modern write time behaviour.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 165e9670280c7073b8d94a4feb2b3d98efdf0fda
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 5" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit f54b9330e134b40fc6096a5f810540c515b99287
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 4" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 86cb56eda688934029d4c1fee415c7987a9c18a4
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 3c" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 141b2ef2769acb92127812a4fc98ec2471b36dea
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 3b" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 83dba3cabc25a7b058177a79ebeddd8ccbac86f6
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 3a" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 1e7d56338a30d31565e2500e7723ed825cd9a605
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time 3" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit f64c25c1a9bcc225878825c889b863fa3bb3c473
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time using 2
connections" for modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 44446d7c556b5c2929485ae3e0c7b1a9c7362735
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.update of write time using
SET_ALLOCATION_SIZE" for modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 344ec3971aedf301b355fcf6ea77ca34196cbbbd
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.update of write time using
SET_END_OF_FILE" for modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit d75abdc3049e0754d49e71a44e6b8f7e4e0b2a63
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.update of write time and SMBwrite
truncate expand" for modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 5bf3a516cab91b91df146095a733686f4861cef7
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.update of write time and SMBwrite
truncate" for modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit e60596f48d7d00ca5c7da479d5332de15cb57f06
Author: Ralph Boehme <[email protected]>
Date: Tue Mar 4 16:32:11 2025 +0100
smbtorture: adjust "base.delaywrite.delayed update of write time" for
modern SMB delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 1a02a9ebabe67dc48f96bc9ad3575ef85eabfe3a
Author: Ralph Boehme <[email protected]>
Date: Mon Mar 3 21:19:55 2025 +0100
smbtorture: adjust "base.delaywrite.finfo update on close" for modern SMB
delayed write
The adjusted test passes against Windows Server 2022.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 43ed3456d9ba4b90efe07dbaefcf85fff9b538d7
Author: Ralph Boehme <[email protected]>
Date: Mon Mar 10 16:18:30 2025 +0100
smbtorture: change variable name in SET_INFO_FILE_EX macro
Allows using the variable name sfinfo in functions that use the macro. No
change
in behaviour.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 24ae9d6a720656ddbc7d8181069cd3179bab0679
Author: Ralph Boehme <[email protected]>
Date: Wed Mar 5 06:09:40 2025 +0100
smbtorture: whitespace in test_delayed_write_update2()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit e2ed11e0f7aa9ca73e40483a24c1556df78ce32e
Author: Ralph Boehme <[email protected]>
Date: Thu Mar 6 12:41:57 2025 +0100
libtorture: add torture_assert_nttime_not_equal[_goto]()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 907f17dda9984dd70af9fd23ab02c21b7c50fbe8
Author: Ralph Boehme <[email protected]>
Date: Fri Mar 14 07:59:33 2025 +0100
smbd: remove get_change_timespec()
Return ctime from the filesystem instead of mtime. Adjust existing tests
by removing ctime check.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
commit 560c7359cedc0286f75d4946e755f7925b9c4e45
Author: Ralph Boehme <[email protected]>
Date: Mon Mar 10 14:03:33 2025 +0100
smbd: check allocsize change request against current allocsize
Cf MS-FSA 2.1.5.15.1 FileAllocationInformation:
If Open.Stream.AllocationSize is equal to NewAllocationSize,
the operation MUST return STATUS_SUCCESS.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13594
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
-----------------------------------------------------------------------
Summary of changes:
lib/torture/torture.h | 17 +
source3/include/vfs.h | 4 +-
source3/librpc/idl/open_files.idl | 5 -
source3/locking/locking.c | 149 +--
source3/locking/proto.h | 6 +-
source3/locking/share_mode_lock.c | 69 +-
source3/locking/share_mode_lock.h | 10 +-
source3/script/tests/test_smbclient_s3.sh | 6 -
source3/script/tests/test_timestamps.sh | 2 +-
source3/smbd/close.c | 83 +-
source3/smbd/dir.c | 16 -
source3/smbd/dir.h | 1 -
source3/smbd/dosmode.c | 21 +-
source3/smbd/durable.c | 43 -
source3/smbd/fileio.c | 181 ++--
source3/smbd/files.c | 3 -
source3/smbd/globals.h | 8 +-
source3/smbd/open.c | 36 +-
source3/smbd/proto.h | 19 +-
source3/smbd/smb1_aio.c | 3 +-
source3/smbd/smb1_nttrans.c | 4 +-
source3/smbd/smb1_reply.c | 43 +-
source3/smbd/smb1_trans2.c | 43 +-
source3/smbd/smb2_aio.c | 3 +-
source3/smbd/smb2_close.c | 2 +-
source3/smbd/smb2_create.c | 3 +-
source3/smbd/smb2_flush.c | 5 -
source3/smbd/smb2_getinfo.c | 9 +-
source3/smbd/smb2_query_directory.c | 196 +---
source3/smbd/smb2_trans2.c | 60 +-
source4/torture/basic/delaywrite.c | 1553 ++++++++++++++---------------
source4/torture/smb2/rename.c | 6 -
source4/torture/smb2/timestamps.c | 959 ++++++++++++++++--
33 files changed, 1804 insertions(+), 1764 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 4ef0d88735b..1bea7bd2c34 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -780,6 +780,23 @@ static inline void torture_dump_data_str_cb(const char
*buf, void *private_data)
}\
} while(0)
+#define torture_assert_nttime_not_equal(torture_ctx,got,expected,cmt) \
+ do { NTTIME __got = got, __expected = expected; \
+ if (nt_time_equal(&__got, &__expected)) { \
+ torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got"
was %s, expected %s: %s", nt_time_string(torture_ctx, __got),
nt_time_string(torture_ctx, __expected), cmt); \
+ return false; \
+ }\
+ } while(0)
+
+#define
torture_assert_nttime_not_equal_goto(torture_ctx,got,expected,ret,label,cmt) \
+ do { NTTIME __got = got, __expected = expected; \
+ if (nt_time_equal(&__got, &__expected)) { \
+ torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got"
was %s, expected %s: %s", nt_time_string(torture_ctx, __got),
nt_time_string(torture_ctx, __expected), cmt); \
+ ret = false; \
+ goto label; \
+ }\
+ } while(0)
+
#define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
do {const struct dom_sid *__got = (got), *__expected = (expected); \
if (!dom_sid_equal(__got, __expected)) { \
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index 581148fa053..d7ac7f0fbaf 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -443,8 +443,6 @@ typedef struct files_struct {
bool is_fsa : 1; /* See below */
bool have_proc_fds : 1;
bool kernel_share_modes_taken : 1;
- bool update_write_time_triggered : 1;
- bool update_write_time_on_close : 1;
bool write_time_forced : 1;
bool can_lock : 1;
bool can_read : 1;
@@ -466,7 +464,7 @@ typedef struct files_struct {
bool posix_append : 1;
} fsp_flags;
- struct tevent_timer *update_write_time_event;
+ /* Only used for SMB1 close with explicit time */
struct timespec close_write_time;
int oplock_type;
diff --git a/source3/librpc/idl/open_files.idl
b/source3/librpc/idl/open_files.idl
index 401b0ec092f..2b5a03589d1 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -70,8 +70,6 @@ interface open_files
[string,charset(UTF8)] char *stream_name;
uint32 num_delete_tokens;
[size_is(num_delete_tokens)] delete_token delete_tokens[];
- NTTIME old_write_time;
- NTTIME changed_write_time;
[skip] boolean8 not_stored;
[skip] boolean8 modified;
[ignore] file_id id; /* In memory key used to lookup cache. */
@@ -111,10 +109,7 @@ interface open_files
[string,charset(UTF8)] char *base_name;
hyper initial_allocation_size;
hyper position_information;
- boolean8 update_write_time_triggered;
- boolean8 update_write_time_on_close;
boolean8 write_time_forced;
- NTTIME close_write_time;
vfs_default_durable_stat stat_info;
} vfs_default_durable_cookie;
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index fefbf88f20a..62f3e2e8037 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -641,8 +641,7 @@ bool rename_share_filename(struct messaging_context
*msg_ctx,
void get_file_infos(struct file_id id,
uint32_t name_hash,
- bool *delete_on_close,
- struct timespec *write_time)
+ bool *delete_on_close)
{
struct share_mode_lock *lck;
@@ -650,10 +649,6 @@ void get_file_infos(struct file_id id,
*delete_on_close = false;
}
- if (write_time) {
- *write_time = make_omit_timespec();
- }
-
if (!(lck = fetch_share_mode_unlocked(talloc_tos(), id))) {
return;
}
@@ -662,10 +657,6 @@ void get_file_infos(struct file_id id,
*delete_on_close = is_delete_on_close_set(lck, name_hash);
}
- if (write_time) {
- *write_time = get_share_mode_write_time(lck);
- }
-
TALLOC_FREE(lck);
}
@@ -1095,144 +1086,6 @@ bool is_delete_on_close_set(struct share_mode_lock
*lck, uint32_t name_hash)
return find_delete_on_close_token(d, name_hash) != NULL;
}
-struct set_sticky_write_time_state {
- struct file_id fileid;
- struct timespec write_time;
- bool ok;
-};
-
-static void set_sticky_write_time_fn(struct share_mode_lock *lck,
- void *private_data)
-{
- struct set_sticky_write_time_state *state = private_data;
- struct share_mode_data *d = NULL;
- struct file_id_buf ftmp;
- struct timeval_buf tbuf;
- NTSTATUS status;
-
- status = share_mode_lock_access_private_data(lck, &d);
- if (!NT_STATUS_IS_OK(status)) {
- /* Any error recovery possible here ? */
- DBG_ERR("share_mode_lock_access_private_data() failed for "
- "%s id=%s - %s\n",
- timespec_string_buf(&state->write_time, true, &tbuf),
- file_id_str_buf(state->fileid, &ftmp),
- nt_errstr(status));
- return;
- }
-
- share_mode_set_changed_write_time(lck, state->write_time);
-
- state->ok = true;
-}
-
-bool set_sticky_write_time(struct file_id fileid, struct timespec write_time)
-{
- struct set_sticky_write_time_state state = {
- .fileid = fileid,
- .write_time = write_time,
- };
- struct file_id_buf ftmp;
- struct timeval_buf tbuf;
- NTSTATUS status;
-
- status = share_mode_do_locked_vfs_denied(fileid,
- set_sticky_write_time_fn,
- &state);
- if (!NT_STATUS_IS_OK(status)) {
- /* Any error recovery possible here ? */
- DBG_ERR("share_mode_do_locked_vfs_denied() failed for "
- "%s id=%s - %s\n",
- timespec_string_buf(&write_time, true, &tbuf),
- file_id_str_buf(fileid, &ftmp),
- nt_errstr(status));
- return false;
- }
-
- return state.ok;
-}
-
-struct set_write_time_state {
- struct file_id fileid;
- struct timespec write_time;
- bool ok;
-};
-
-static void set_write_time_fn(struct share_mode_lock *lck,
- void *private_data)
-{
- struct set_write_time_state *state = private_data;
- struct share_mode_data *d = NULL;
- struct file_id_buf idbuf;
- struct timeval_buf tbuf;
- NTSTATUS status;
-
- status = share_mode_lock_access_private_data(lck, &d);
- if (!NT_STATUS_IS_OK(status)) {
- /* Any error recovery possible here ? */
- DBG_ERR("share_mode_lock_access_private_data() failed for "
- "%s id=%s - %s\n",
- timespec_string_buf(&state->write_time, true, &tbuf),
- file_id_str_buf(state->fileid, &idbuf),
- nt_errstr(status));
- return;
- }
-
- share_mode_set_old_write_time(lck, state->write_time);
-
- state->ok = true;
-}
-
-bool set_write_time(struct file_id fileid, struct timespec write_time)
-{
- struct set_write_time_state state = {
- .fileid = fileid,
- .write_time = write_time,
- };
- struct file_id_buf idbuf;
- struct timeval_buf tbuf;
- NTSTATUS status;
-
- status = share_mode_do_locked_vfs_denied(fileid,
- set_write_time_fn,
- &state);
- if (!NT_STATUS_IS_OK(status)) {
- DBG_ERR("share_mode_do_locked_vfs_denied() failed for "
- "%s id=%s - %s\n",
- timespec_string_buf(&write_time, true, &tbuf),
- file_id_str_buf(fileid, &idbuf),
- nt_errstr(status));
- return false;
- }
-
- return state.ok;
-}
-
-struct timespec get_share_mode_write_time(struct share_mode_lock *lck)
-{
- struct share_mode_data *d = NULL;
- NTSTATUS status;
-
- status = share_mode_lock_access_private_data(lck, &d);
- if (!NT_STATUS_IS_OK(status)) {
- struct file_id id = share_mode_lock_file_id(lck);
- struct file_id_buf id_buf;
- struct timespec ts_zero = {};
- /* Any error recovery possible here ? */
- DBG_ERR("share_mode_lock_access_private_data() failed for "
- "%s - %s\n",
- file_id_str_buf(id, &id_buf),
- nt_errstr(status));
- smb_panic(__location__);
- return ts_zero;
- }
-
- if (!null_nttime(d->changed_write_time)) {
- return nt_time_to_full_timespec(d->changed_write_time);
- }
- return nt_time_to_full_timespec(d->old_write_time);
-}
-
struct file_has_open_streams_state {
bool found_one;
bool ok;
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index adfe5fede8f..524d1d6d145 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -137,8 +137,7 @@ bool rename_share_filename(struct messaging_context
*msg_ctx,
const struct smb_filename *smb_fname);
void get_file_infos(struct file_id id,
uint32_t name_hash,
- bool *delete_on_close,
- struct timespec *write_time);
+ bool *delete_on_close);
bool is_valid_share_mode_entry(const struct share_mode_entry *e);
bool share_entry_stale_pid(struct share_mode_entry *e);
NTSTATUS remove_lease_if_stale(struct share_mode_lock *lck,
@@ -159,9 +158,6 @@ bool set_delete_on_close(files_struct *fsp, bool
delete_on_close,
const struct security_token *nt_tok,
const struct security_unix_token *tok);
bool is_delete_on_close_set(struct share_mode_lock *lck, uint32_t name_hash);
-bool set_sticky_write_time(struct file_id fileid, struct timespec write_time);
-bool set_write_time(struct file_id fileid, struct timespec write_time);
-struct timespec get_share_mode_write_time(struct share_mode_lock *lck);
bool file_has_open_streams(files_struct *fsp);
bool share_mode_forall_leases(
struct share_mode_lock *lck,
diff --git a/source3/locking/share_mode_lock.c
b/source3/locking/share_mode_lock.c
index 8ccb3bdeaec..0bd4cbba711 100644
--- a/source3/locking/share_mode_lock.c
+++ b/source3/locking/share_mode_lock.c
@@ -707,13 +707,11 @@ static NTSTATUS share_mode_data_store(struct
share_mode_data *d)
static struct share_mode_data *fresh_share_mode_lock(
TALLOC_CTX *mem_ctx, const char *servicepath,
- const struct smb_filename *smb_fname,
- const struct timespec *old_write_time)
+ const struct smb_filename *smb_fname)
{
struct share_mode_data *d;
- if ((servicepath == NULL) || (smb_fname == NULL) ||
- (old_write_time == NULL)) {
+ if ((servicepath == NULL) || (smb_fname == NULL)) {
return NULL;
}
@@ -737,7 +735,6 @@ static struct share_mode_data *fresh_share_mode_lock(
if (d->servicepath == NULL) {
goto fail;
}
- d->old_write_time = full_timespec_to_nt_time(old_write_time);
d->flags = SHARE_MODE_SHARE_DELETE |
SHARE_MODE_SHARE_WRITE |
SHARE_MODE_SHARE_READ;
@@ -800,7 +797,6 @@ struct get_static_share_mode_data_state {
struct file_id id;
const char *servicepath;
const struct smb_filename *smb_fname;
- const struct timespec *old_write_time;
NTSTATUS status;
};
@@ -835,8 +831,7 @@ static void get_static_share_mode_data_fn(
d = fresh_share_mode_lock(
state->mem_ctx,
state->servicepath,
- state->smb_fname,
- state->old_write_time);
+ state->smb_fname);
if (d == NULL) {
state->status = NT_STATUS_NO_MEMORY;
return;
@@ -860,15 +855,13 @@ static void get_static_share_mode_data_fn(
static NTSTATUS get_static_share_mode_data(
struct file_id id,
const char *servicepath,
- const struct smb_filename *smb_fname,
- const struct timespec *old_write_time)
+ const struct smb_filename *smb_fname)
{
struct get_static_share_mode_data_state state = {
.mem_ctx = lock_ctx,
.id = id,
.servicepath = servicepath,
.smb_fname = smb_fname,
- .old_write_time = old_write_time,
};
NTSTATUS status;
@@ -923,7 +916,6 @@ static NTSTATUS get_share_mode_lock_internal(
struct file_id id,
const char *servicepath,
const struct smb_filename *smb_fname,
- const struct timespec *old_write_time,
struct share_mode_lock *lck)
{
NTSTATUS status;
@@ -973,8 +965,7 @@ static NTSTATUS get_share_mode_lock_internal(
status = get_static_share_mode_data(
id,
servicepath,
- smb_fname,
- old_write_time);
+ smb_fname);
if (!NT_STATUS_IS_OK(status)) {
DBG_DEBUG("get_static_share_mode_data failed: %s\n",
nt_errstr(status));
@@ -1081,7 +1072,6 @@ struct share_mode_lock
*get_existing_share_mode_lock(TALLOC_CTX *mem_ctx,
status = get_share_mode_lock_internal(id,
NULL, /* servicepath */
NULL, /* smb_fname */
- NULL, /* old_write_time */
lck);
if (!NT_STATUS_IS_OK(status)) {
DBG_GET_SHARE_MODE_LOCK(status,
@@ -1240,48 +1230,6 @@ static struct share_mode_data
*_share_mode_lock_assert_private_data(
return d;
}
-NTTIME share_mode_changed_write_time(struct share_mode_lock *lck)
-{
- struct share_mode_data *d = share_mode_lock_assert_private_data(lck);
- return d->changed_write_time;
-}
-
-void share_mode_set_changed_write_time(struct share_mode_lock *lck, struct
timespec write_time)
-{
- struct file_id fileid = share_mode_lock_file_id(lck);
- struct share_mode_data *d = share_mode_lock_assert_private_data(lck);
- struct file_id_buf ftmp;
- struct timeval_buf tbuf;
- NTTIME nt = full_timespec_to_nt_time(&write_time);
-
- DBG_INFO("%s id=%s\n",
- timespec_string_buf(&write_time, true, &tbuf),
- file_id_str_buf(fileid, &ftmp));
-
- if (d->changed_write_time != nt) {
- d->modified = true;
- d->changed_write_time = nt;
- }
-}
-
-void share_mode_set_old_write_time(struct share_mode_lock *lck, struct
timespec write_time)
-{
- struct file_id fileid = share_mode_lock_file_id(lck);
- struct share_mode_data *d = share_mode_lock_assert_private_data(lck);
- struct file_id_buf ftmp;
- struct timeval_buf tbuf;
- NTTIME nt = full_timespec_to_nt_time(&write_time);
-
- DBG_INFO("%s id=%s\n",
- timespec_string_buf(&write_time, true, &tbuf),
- file_id_str_buf(fileid, &ftmp));
-
- if (d->changed_write_time != nt) {
- d->modified = true;
- d->old_write_time = nt;
- }
-}
-
const char *share_mode_servicepath(struct share_mode_lock *lck)
{
struct share_mode_data *d = share_mode_lock_assert_private_data(lck);
@@ -3178,7 +3126,6 @@ static void share_mode_do_locked_vfs_denied_fn(struct
g_lock_lock_cb_state *glck
state->status = get_share_mode_lock_internal(state->id,
NULL, /* servicepath */
NULL, /* smb_fname */
- NULL, /* old_write_time */
&lck);
if (!NT_STATUS_IS_OK(state->status)) {
DBG_GET_SHARE_MODE_LOCK(state->status,
@@ -3289,7 +3236,6 @@ NTSTATUS _share_mode_do_locked_vfs_allowed(
status = get_share_mode_lock_internal(id,
NULL, /* servicepath */
NULL, /* smb_fname */
- NULL, /* old_write_time */
&lck);
if (!NT_STATUS_IS_OK(status)) {
DBG_GET_SHARE_MODE_LOCK(status,
@@ -3315,7 +3261,6 @@ struct share_mode_entry_prepare_lock_state {
struct file_id id;
const char *servicepath;
const struct smb_filename *smb_fname;
- const struct timespec *old_write_time;
share_mode_entry_prepare_lock_fn_t fn;
void *private_data;
const char *location;
@@ -3337,7 +3282,6 @@ static void share_mode_entry_prepare_lock_fn(struct
g_lock_lock_cb_state *glck,
state->status = get_share_mode_lock_internal(state->id,
state->servicepath,
state->smb_fname,
- state->old_write_time,
state->lck);
if (!NT_STATUS_IS_OK(state->status)) {
/* no DBG_GET_SHARE_MODE_LOCK here! */
@@ -3375,7 +3319,6 @@ NTSTATUS _share_mode_entry_prepare_lock(
struct file_id id,
const char *servicepath,
const struct smb_filename *smb_fname,
- const struct timespec *old_write_time,
share_mode_entry_prepare_lock_fn_t fn,
void *private_data,
const char *location)
@@ -3384,7 +3327,6 @@ NTSTATUS _share_mode_entry_prepare_lock(
.id = id,
.servicepath = servicepath,
.smb_fname = smb_fname,
- .old_write_time = old_write_time,
.fn = fn,
.private_data = private_data,
.location = location,
@@ -3468,7 +3410,6 @@ static void
share_mode_entry_prepare_unlock_relock_fn(struct g_lock_lock_cb_stat
state->status = get_share_mode_lock_internal(state->id,
NULL, /* servicepath */
NULL, /* smb_fname */
- NULL, /* old_write_time */
state->lck);
if (!NT_STATUS_IS_OK(state->status)) {
/* no DBG_GET_SHARE_MODE_LOCK here! */
diff --git a/source3/locking/share_mode_lock.h
b/source3/locking/share_mode_lock.h
index 97a7a847f54..0a2696d38a2 100644
--- a/source3/locking/share_mode_lock.h
+++ b/source3/locking/share_mode_lock.h
@@ -111,9 +111,6 @@ bool share_mode_forall_entries(
void *private_data),
void *private_data);
-NTTIME share_mode_changed_write_time(struct share_mode_lock *lck);
-void share_mode_set_changed_write_time(struct share_mode_lock *lck, struct
timespec write_time);
-void share_mode_set_old_write_time(struct share_mode_lock *lck, struct
timespec write_time);
const char *share_mode_servicepath(struct share_mode_lock *lck);
char *share_mode_filename(TALLOC_CTX *mem_ctx, struct share_mode_lock *lck);
char *share_mode_data_dump(
@@ -179,20 +176,19 @@ NTSTATUS _share_mode_entry_prepare_lock(
struct file_id id,
const char *servicepath,
const struct smb_filename *smb_fname,
- const struct timespec *old_write_time,
share_mode_entry_prepare_lock_fn_t fn,
void *private_data,
const char *location);
#define share_mode_entry_prepare_lock_add(__prepare_state, __id, \
- __servicepath, __smb_fname, __old_write_time, \
+ __servicepath, __smb_fname, \
__fn, __private_data) \
_share_mode_entry_prepare_lock(__prepare_state, __id, \
--
Samba Shared Repository