--- source3/smbd/filename.c.orig 2012-04-25 14:33:34.720488047 -0400 +++ source3/smbd/filename.c 2012-04-25 14:33:54.712684664 -0400 @@ -871,7 +871,7 @@ goto fail; } - get_file_infos(vfs_file_id_from_sbuf(conn, + get_file_infos(conn, vfs_file_id_from_sbuf(conn, &smb_fname->st), name_hash, &delete_pending, NULL); --- source3/smbd/nttrans.c.orig 2012-04-25 14:34:38.689118563 -0400 +++ source3/smbd/nttrans.c 2012-04-25 14:35:26.249587834 -0400 @@ -658,7 +658,7 @@ /* Deal with other possible opens having a modified write time. JRA. */ ZERO_STRUCT(write_time_ts); - get_file_infos(fsp->file_id, 0, NULL, &write_time_ts); + get_file_infos(conn, fsp->file_id, 0, NULL, &write_time_ts); if (!null_timespec(write_time_ts)) { update_stat_ex_mtime(&smb_fname->st, write_time_ts); } @@ -1239,7 +1239,7 @@ /* Deal with other possible opens having a modified write time. JRA. */ ZERO_STRUCT(write_time_ts); - get_file_infos(fsp->file_id, 0, NULL, &write_time_ts); + get_file_infos(conn, fsp->file_id, 0, NULL, &write_time_ts); if (!null_timespec(write_time_ts)) { update_stat_ex_mtime(&smb_fname->st, write_time_ts); } --- source3/smbd/dir.c.orig 2012-04-24 18:07:39.082823196 -0400 +++ source3/smbd/dir.c 2012-04-25 14:32:55.000095207 -0400 @@ -1028,7 +1028,7 @@ fileid = vfs_file_id_from_sbuf(conn, &smb_fname.st); - get_file_infos(fileid, 0, NULL, &write_time_ts); + get_file_infos(conn, fileid, 0, NULL, &write_time_ts); if (!null_timespec(write_time_ts)) { update_stat_ex_mtime(&smb_fname.st, write_time_ts); --- source3/smbd/smb2_getinfo.c.orig 2012-04-25 14:30:14.866509399 -0400 +++ source3/smbd/smb2_getinfo.c 2012-04-25 14:30:40.354763076 -0400 @@ -353,7 +353,7 @@ fileid = vfs_file_id_from_sbuf(conn, &fsp->fsp_name->st); - get_file_infos(fileid, fsp->name_hash, + get_file_infos(conn, fileid, fsp->name_hash, &delete_pending, &write_time_ts); } else { /* @@ -370,7 +370,7 @@ } fileid = vfs_file_id_from_sbuf(conn, &fsp->fsp_name->st); - get_file_infos(fileid, fsp->name_hash, + get_file_infos(conn, fileid, fsp->name_hash, &delete_pending, &write_time_ts); } --- source3/smbd/reply.c.orig 2012-04-25 14:33:00.480149445 -0400 +++ source3/smbd/reply.c 2012-04-25 14:33:27.256413989 -0400 @@ -1147,7 +1147,7 @@ ZERO_STRUCT(write_time_ts); fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st); - get_file_infos(fileid, 0, NULL, &write_time_ts); + get_file_infos(conn, fileid, 0, NULL, &write_time_ts); if (!null_timespec(write_time_ts)) { update_stat_ex_mtime(&smb_fname->st, write_time_ts); } @@ -1810,7 +1810,7 @@ struct timespec write_time_ts; ZERO_STRUCT(write_time_ts); - get_file_infos(fsp->file_id, 0, NULL, &write_time_ts); + get_file_infos(conn, fsp->file_id, 0, NULL, &write_time_ts); if (!null_timespec(write_time_ts)) { update_stat_ex_mtime(&smb_fname->st, write_time_ts); } --- source3/smbd/smb2_create.c.orig 2012-04-25 14:35:36.585687936 -0400 +++ source3/smbd/smb2_create.c 2012-04-25 14:35:54.513865764 -0400 @@ -805,7 +805,7 @@ /* Deal with other possible opens having a modified write time. JRA. */ ZERO_STRUCT(write_time_ts); - get_file_infos(result->file_id, 0, NULL, &write_time_ts); + get_file_infos(result->conn, result->file_id, 0, NULL, &write_time_ts); if (!null_timespec(write_time_ts)) { update_stat_ex_mtime(&result->fsp_name->st, write_time_ts); } --- source3/smbd/trans2.c.orig 2012-04-25 14:34:01.768754758 -0400 +++ source3/smbd/trans2.c 2012-04-25 14:34:27.000998945 -0400 @@ -5085,7 +5085,7 @@ } fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st); - get_file_infos(fileid, fsp->name_hash, &delete_pending, &write_time_ts); + get_file_infos(conn, fileid, fsp->name_hash, &delete_pending, &write_time_ts); } else { /* * Original code - this is an open file. @@ -5098,7 +5098,7 @@ return; } fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st); - get_file_infos(fileid, fsp->name_hash, &delete_pending, &write_time_ts); + get_file_infos(conn, fileid, fsp->name_hash, &delete_pending, &write_time_ts); } } else { @@ -5209,7 +5209,7 @@ fileid = vfs_file_id_from_sbuf(conn, &smb_fname_base->st); TALLOC_FREE(smb_fname_base); - get_file_infos(fileid, name_hash, &delete_pending, NULL); + get_file_infos(conn, fileid, name_hash, &delete_pending, NULL); if (delete_pending) { reply_nterror(req, NT_STATUS_DELETE_PENDING); return; @@ -5249,7 +5249,7 @@ } fileid = vfs_file_id_from_sbuf(conn, &smb_fname->st); - get_file_infos(fileid, name_hash, &delete_pending, &write_time_ts); + get_file_infos(conn, fileid, name_hash, &delete_pending, &write_time_ts); if (delete_pending) { reply_nterror(req, NT_STATUS_DELETE_PENDING); return; --- source3/include/proto.h.orig 2012-04-24 18:06:09.665882769 -0400 +++ source3/include/proto.h 2012-04-24 18:06:36.146160915 -0400 @@ -1514,6 +1514,7 @@ bool lp_hostname_lookups(void); bool lp_change_notify(const struct share_params *p ); bool lp_kernel_change_notify(const struct share_params *p ); +bool lp_cache_locked_write_times(const struct share_params *p ); char * lp_dedicated_keytab_file(void); int lp_kerberos_method(void); bool lp_defer_sharing_violations(void); --- source3/locking/proto.h.orig 2012-04-25 14:27:26.928840423 -0400 +++ source3/locking/proto.h 2012-04-25 14:29:57.266335597 -0400 @@ -155,7 +155,8 @@ uint32_t orig_name_hash, uint32_t new_name_hash, const struct smb_filename *smb_fname); -void get_file_infos(struct file_id id, +void get_file_infos(struct connection_struct *conn, + struct file_id id, uint32_t name_hash, bool *delete_on_close, struct timespec *write_time); --- source3/locking/locking.c.orig 2012-04-25 14:27:08.488655293 -0400 +++ source3/locking/locking.c 2012-04-26 12:15:53.091689289 -0400 @@ -1128,7 +1128,8 @@ return True; } -void get_file_infos(struct file_id id, +void get_file_infos(struct connection_struct *conn, + struct file_id id, uint32_t name_hash, bool *delete_on_close, struct timespec *write_time) @@ -1151,7 +1152,7 @@ *delete_on_close = is_delete_on_close_set(lck, name_hash); } - if (write_time) { + if (write_time && lp_cache_locked_write_times(conn->params)) { struct timespec wt; wt = lck->changed_write_time; --- source3/param/loadparm.c.orig 2012-04-24 17:54:44.254715616 -0400 +++ source3/param/loadparm.c 2012-04-24 18:05:12.209281354 -0400 @@ -524,6 +524,7 @@ bool bAclGroupControl; bool bChangeNotify; bool bKernelChangeNotify; + bool bCacheLockedWriteTimes; int iallocation_roundup_size; int iAioReadSize; int iAioWriteSize; @@ -669,6 +670,7 @@ False, /* bAclGroupControl */ True, /* bChangeNotify */ True, /* bKernelChangeNotify */ + True, /* bCacheLockedWriteTimes */ SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */ 0, /* iAioReadSize */ 0, /* iAioWriteSize */ @@ -2428,6 +2430,15 @@ .flags = FLAG_ADVANCED | FLAG_SHARE, }, { + .label = "cache locked write times", + .type = P_BOOL, + .p_class = P_LOCAL, + .ptr = &sDefault.bCacheLockedWriteTimes, + .special = NULL, + .enum_list = NULL, + .flags = FLAG_ADVANCED | FLAG_SHARE, + }, + { .label = "lpq cache time", .type = P_INTEGER, .p_class = P_GLOBAL, @@ -5833,6 +5844,7 @@ FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups) FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify) FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify) +FN_LOCAL_PARM_BOOL(lp_cache_locked_write_times, bCacheLockedWriteTimes) FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile) FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod) FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)