summaryrefslogtreecommitdiff
path: root/source3/smbd/open.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-11-22 16:24:42 +0000
committerJeremy Allison <jra@samba.org>2013-11-23 00:40:49 +0100
commita793ac016db95290470515d89c187365bfcb4f18 (patch)
tree54143fc0e151b1a16ec11ca7d27480363260844d /source3/smbd/open.c
parent4e344aba4e66e2e4f59f407f305072bfbb82dc7d (diff)
downloadsamba-a793ac016db95290470515d89c187365bfcb4f18.tar.gz
smbd: Pull mtime handling into open_file_ntcreate
This is a performance improvement for heavily contended files, in particular in a cluster. The separate call to get_file_infos makes us pull the locking.tdb record twice per open. For a contended file this can be a performance penalty, this gets the # of record accesses for the open/close cycle down from 3 to 2. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Sat Nov 23 00:40:49 CET 2013 on sn-devel-104
Diffstat (limited to 'source3/smbd/open.c')
-rw-r--r--source3/smbd/open.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 5370cb8ab11..2d866bbce52 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -2845,6 +2845,17 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
(unsigned int)new_unx_mode));
}
+ {
+ /*
+ * Deal with other opens having a modified write time.
+ */
+ struct timespec write_time = get_share_mode_write_time(lck);
+
+ if (!null_timespec(write_time)) {
+ update_stat_ex_mtime(&fsp->fsp_name->st, write_time);
+ }
+ }
+
TALLOC_FREE(lck);
return NT_STATUS_OK;
@@ -3281,6 +3292,18 @@ static NTSTATUS open_directory(connection_struct *conn,
}
}
+ {
+ /*
+ * Deal with other opens having a modified write time. Is this
+ * possible for directories?
+ */
+ struct timespec write_time = get_share_mode_write_time(lck);
+
+ if (!null_timespec(write_time)) {
+ update_stat_ex_mtime(&fsp->fsp_name->st, write_time);
+ }
+ }
+
TALLOC_FREE(lck);
if (pinfo) {