summaryrefslogtreecommitdiffstats
path: root/source3/smbd/durable.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-10-19 10:58:47 +0200
committerMichael Adam <obnox@samba.org>2012-10-19 15:21:10 +0200
commit137376391d5642c0a18ff70a5184dac4b402fa42 (patch)
tree1a40c254c29cb04b0d1effbddb80689ebc8b36f0 /source3/smbd/durable.c
parent9e7bce53707732700928eaf2bb53a5f1cc5d7784 (diff)
downloadsamba-137376391d5642c0a18ff70a5184dac4b402fa42.tar.gz
samba-137376391d5642c0a18ff70a5184dac4b402fa42.tar.xz
samba-137376391d5642c0a18ff70a5184dac4b402fa42.zip
s3:smbd/durable: update the low level write_time before disconnecting the file.
If we close the low level FD, we should better update the write_time if needed. It's not unlikely that the client doesn't reclaim the durable handle, in that case we may not close the after the durable timeout. In such a case we should make sure that we at least update the write time on disconnect, this makes sure backup applications notice that the file was changed. metze Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/smbd/durable.c')
-rw-r--r--source3/smbd/durable.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index feec0dad6e3..f8e82c2a14a 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -187,6 +187,25 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
*/
lck = get_existing_share_mode_lock(talloc_tos(), fsp->file_id);
if (lck != NULL) {
+ struct smb_file_time ft;
+
+ ZERO_STRUCT(ft);
+
+ if (fsp->write_time_forced) {
+ ft.mtime = lck->data->changed_write_time;
+ } else if (fsp->update_write_time_on_close) {
+ if (null_timespec(fsp->close_write_time)) {
+ ft.mtime = timespec_current();
+ } else {
+ ft.mtime = fsp->close_write_time;
+ }
+ }
+
+ if (!null_timespec(ft.mtime)) {
+ round_timespec(conn->ts_res, &ft.mtime);
+ file_ntimes(conn, fsp->fsp_name, &ft);
+ }
+
ok = mark_share_mode_disconnected(lck, fsp);
if (!ok) {
TALLOC_FREE(lck);