[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-903-gd296c77

Jeremy Allison jra at samba.org
Fri Aug 7 13:39:49 MDT 2009


The branch, master has been updated
       via  d296c774c5981baa863c697782dba1b6280d632e (commit)
      from  ea6819ae7565c22b0d6276acebfbab472a4e4c18 (commit)

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


- Log -----------------------------------------------------------------
commit d296c774c5981baa863c697782dba1b6280d632e
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Aug 7 12:38:31 2009 -0700

    Move the checks for null timestamps down below the VFS_NTIMES
    layer (as it's done in onefs). This simplifies greatly the
    code in smb_set_file_time() w.r.t. changenotify messages.
    Jeremy.

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

Summary of changes:
 source3/modules/vfs_default.c |   15 +++++++++++++++
 source3/smbd/trans2.c         |   33 +++------------------------------
 2 files changed, 18 insertions(+), 30 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index a4922e7..2ee2fd1 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -780,6 +780,21 @@ static int vfswrap_ntimes(vfs_handle_struct *handle,
 		goto out;
 	}
 
+	if (null_timespec(ft->atime)) {
+		ft->atime= smb_fname->st.st_ex_atime;
+	}
+
+	if (null_timespec(ft->mtime)) {
+		ft->mtime = smb_fname->st.st_ex_mtime;
+	}
+
+	if ((timespec_compare(&ft->atime,
+				&smb_fname->st.st_ex_atime) == 0) &&
+			(timespec_compare(&ft->mtime,
+				&smb_fname->st.st_ex_mtime) == 0)) {
+		return 0;
+	}
+
 #if defined(HAVE_UTIMES)
 	if (ft != NULL) {
 		struct timeval tv[2];
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index a8b7211..2e47eab 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -5222,8 +5222,8 @@ NTSTATUS smb_set_file_time(connection_struct *conn,
 	struct smb_filename *smb_fname_base = NULL;
 	uint32 action =
 		FILE_NOTIFY_CHANGE_LAST_ACCESS
-		|FILE_NOTIFY_CHANGE_LAST_WRITE;
-	bool set_createtime = false;
+		|FILE_NOTIFY_CHANGE_LAST_WRITE
+		|FILE_NOTIFY_CHANGE_CREATION;
 	NTSTATUS status;
 
 	if (!VALID_STAT(smb_fname->st)) {
@@ -5232,22 +5232,14 @@ NTSTATUS smb_set_file_time(connection_struct *conn,
 
 	/* get some defaults (no modifications) if any info is zero or -1. */
 	if (null_timespec(ft->create_time)) {
-		ft->create_time = smb_fname->st.st_ex_btime;
-	} else {
-		set_createtime = true;
-	}
-
-	if (null_timespec(ft->ctime)) {
-		ft->ctime = smb_fname->st.st_ex_ctime;
+		action &= ~FILE_NOTIFY_CHANGE_CREATION;
 	}
 
 	if (null_timespec(ft->atime)) {
-		ft->atime= smb_fname->st.st_ex_atime;
 		action &= ~FILE_NOTIFY_CHANGE_LAST_ACCESS;
 	}
 
 	if (null_timespec(ft->mtime)) {
-		ft->mtime = smb_fname->st.st_ex_mtime;
 		action &= ~FILE_NOTIFY_CHANGE_LAST_WRITE;
 	}
 
@@ -5265,25 +5257,6 @@ NTSTATUS smb_set_file_time(connection_struct *conn,
 	DEBUG(5,("smb_set_file_time: createtime: %s\n ",
 		time_to_asc(convert_timespec_to_time_t(ft->create_time))));
 
-	/*
-	 * Try and set the times of this file if
-	 * they are different from the current values.
-	 */
-
-	{
-		struct timespec mts = smb_fname->st.st_ex_mtime;
-		struct timespec ats = smb_fname->st.st_ex_atime;
-		if ((timespec_compare(&ft->atime, &ats) == 0) &&
-		    (timespec_compare(&ft->mtime, &mts) == 0)) {
-			if (set_createtime) {
-				notify_fname(conn, NOTIFY_ACTION_MODIFIED,
-						FILE_NOTIFY_CHANGE_CREATION,
-						smb_fname->base_name);
-			}
-			return NT_STATUS_OK;
-		}
-	}
-
 	if (setting_write_time) {
 		/*
 		 * This was a Windows setfileinfo on an open file.


-- 
Samba Shared Repository


More information about the samba-cvs mailing list