[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Fri Oct 19 09:13:01 MDT 2012


The branch, master has been updated
       via  24d225f s3:smbd/durable: add write_time specific stuff to vfs_default_durable_cookie
       via  506249b s3:open_files.idl: add write_time specific stuff to vfs_default_durable_cookie
       via  1373763 s3:smbd/durable: update the low level write_time before disconnecting the file.
       via  9e7bce5 s3:smbd/durable: trigger pending write_time updates before disconnecting the file
      from  81d0b8a docs-xml:smbd.8: document new smbXsrv_*_global.tdb files

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 24d225f44ee4958ed5e2bd934125a9b0c4fc3323
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Oct 19 11:12:05 2012 +0200

    s3:smbd/durable: add write_time specific stuff to vfs_default_durable_cookie
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Fri Oct 19 17:12:29 CEST 2012 on sn-devel-104

commit 506249b86382331c39676b8632ad33b535f9fb03
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Oct 19 11:12:05 2012 +0200

    s3:open_files.idl: add write_time specific stuff to vfs_default_durable_cookie
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 137376391d5642c0a18ff70a5184dac4b402fa42
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Oct 19 10:58:47 2012 +0200

    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 at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit 9e7bce53707732700928eaf2bb53a5f1cc5d7784
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Oct 19 10:54:27 2012 +0200

    s3:smbd/durable: trigger pending write_time updates before disconnecting the file
    
    We need to call the pending write time update handler immediately.
    Which means we don't wait exactly 2 seconds before updating the write time
    after the first write.
    
    metze
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/librpc/idl/open_files.idl |    4 +++
 source3/smbd/durable.c            |   39 +++++++++++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index eb0dfa0..0dd9859 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -61,5 +61,9 @@ 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;
+		timespec close_write_time;
 	} vfs_default_durable_cookie;
 }
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index 42ad18e..348135c 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -99,6 +99,10 @@ NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp,
 	cookie.base_name = fsp->fsp_name->base_name;
 	cookie.initial_allocation_size = fsp->initial_allocation_size;
 	cookie.position_information = fsp->fh->position_information;
+	cookie.update_write_time_triggered = fsp->update_write_time_triggered;
+	cookie.update_write_time_on_close = fsp->update_write_time_on_close;
+	cookie.write_time_forced = fsp->write_time_forced;
+	cookie.close_write_time = fsp->close_write_time;
 
 	ndr_err = ndr_push_struct_blob(cookie_blob, mem_ctx, &cookie,
 			(ndr_push_flags_fn_t)ndr_push_vfs_default_durable_cookie);
@@ -173,12 +177,39 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
 		return NT_STATUS_NOT_SUPPORTED;
 	}
 
+	/* Ensure any pending write time updates are done. */
+	if (fsp->update_write_time_event) {
+		update_write_time_handler(fsp->conn->sconn->ev_ctx,
+					fsp->update_write_time_event,
+					timeval_current(),
+					(void *)fsp);
+	}
+
 	/*
 	 * The above checks are done in mark_share_mode_disconnected() too
 	 * but we want to avoid getting the lock if possible
 	 */
 	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);
@@ -202,6 +233,10 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
 	cookie.base_name = fsp->fsp_name->base_name;
 	cookie.initial_allocation_size = fsp->initial_allocation_size;
 	cookie.position_information = fsp->fh->position_information;
+	cookie.update_write_time_triggered = fsp->update_write_time_triggered;
+	cookie.update_write_time_on_close = fsp->update_write_time_on_close;
+	cookie.write_time_forced = fsp->write_time_forced;
+	cookie.close_write_time = fsp->close_write_time;
 
 	ndr_err = ndr_push_struct_blob(&new_cookie_blob, mem_ctx, &cookie,
 			(ndr_push_flags_fn_t)ndr_push_vfs_default_durable_cookie);
@@ -426,6 +461,10 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn,
 
 	fsp->initial_allocation_size = cookie.initial_allocation_size;
 	fsp->fh->position_information = cookie.position_information;
+	fsp->update_write_time_triggered = cookie.update_write_time_triggered;
+	fsp->update_write_time_on_close = cookie.update_write_time_on_close;
+	fsp->write_time_forced = cookie.write_time_forced;
+	fsp->close_write_time = cookie.close_write_time;
 
 	status = fsp_set_smb_fname(fsp, smb_fname);
 	if (!NT_STATUS_IS_OK(status)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list