[SCM] Samba Shared Repository - branch v3-5-test updated

Jeremy Allison jra at samba.org
Thu Nov 5 18:42:51 MST 2009


The branch, v3-5-test has been updated
       via  329969f... Simplify the logic - remove extraneous argument and calls to set_close_write_time(). We were treating a file time set on close as a sticky write time set, and I don't think it is. I will add a torture test later to RAW-CLOSE to confirm this. Jeremy. (cherry picked from commit 0551284dc08eb93ef7b2b2227a45e5ec21d482fb)
      from  bf21f34... Fix explicit set of write time on close. Jeremy. (cherry picked from commit 2f09516a6be67d3e51ffc611ae2daa3210f07cd8)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit 329969f0b759d6face8d8435bbd4d039b9a03c2a
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Nov 5 17:40:01 2009 -0800

    Simplify the logic - remove extraneous argument and calls to set_close_write_time().
    We were treating a file time set on close as a sticky write time set, and I don't
    think it is. I will add a torture test later to RAW-CLOSE to confirm this.
    Jeremy.
    (cherry picked from commit 0551284dc08eb93ef7b2b2227a45e5ec21d482fb)

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

Summary of changes:
 source3/include/proto.h |    4 +---
 source3/smbd/close.c    |   34 +++++++---------------------------
 source3/smbd/nttrans.c  |    2 +-
 source3/smbd/reply.c    |    6 +++---
 4 files changed, 12 insertions(+), 34 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index cd93bb3..f37df24 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6108,9 +6108,7 @@ NTSTATUS change_oem_password(struct samu *hnd, char *old_passwd, char *new_passw
 
 /* The following definitions come from smbd/close.c  */
 
-void set_close_write_time(struct share_mode_lock *lck,
-			struct files_struct *fsp,
-			struct timespec ts);
+void set_close_write_time(struct files_struct *fsp, struct timespec ts);
 NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
 		    enum file_close_type close_type);
 void msg_close_file(struct messaging_context *msg_ctx,
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 0f1bd90..3de93b1 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -294,16 +294,7 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
 		DEBUG(10,("close_remove_share_mode: write time forced "
 			"for file %s\n",
 			fsp_str_dbg(fsp)));
-		set_close_write_time(lck, fsp, lck->changed_write_time);
-	} else if (fsp->update_write_time_on_close) {
-		DEBUG(10,("close_remove_share_mode: update_write_time_on_close "
-			"set for file %s\n",
-			fsp_str_dbg(fsp)));
-		if (null_timespec(fsp->close_write_time)) {
-			set_close_write_time(lck, fsp, timespec_current());
-		} else {
-			set_close_write_time(lck, fsp, fsp->close_write_time);
-		}
+		set_close_write_time(fsp, lck->changed_write_time);
 	}
 
 	if (!del_share_mode(lck, fsp)) {
@@ -480,30 +471,15 @@ static NTSTATUS close_remove_share_mode(files_struct *fsp,
 	return status;
 }
 
-void set_close_write_time(struct share_mode_lock *lck,
-			struct files_struct *fsp, struct timespec ts)
+void set_close_write_time(struct files_struct *fsp, struct timespec ts)
 {
 	DEBUG(6,("close_write_time: %s" , time_to_asc(convert_timespec_to_time_t(ts))));
 
 	if (null_timespec(ts)) {
 		return;
 	}
-	/*
-	 * if the write time on close is explict set, then don't
-	 * need to fix it up to the value in the locking db
-	 */
-	fsp->write_time_forced = false;
-
 	fsp->update_write_time_on_close = true;
 	fsp->close_write_time = ts;
-
-	/* On close if we're changing the real file time we
-	 * must update it in the open file db too. */
-	(void)set_write_time(fsp->file_id, ts);
-	/* If someone has a sticky write time then update it as well. */
-	if (lck && !null_timespec(lck->changed_write_time)) {
-		(void)set_sticky_write_time(fsp->file_id, ts);
-	}
 }
 
 static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
@@ -532,8 +508,12 @@ static NTSTATUS update_write_time_on_close(struct files_struct *fsp)
 		return NT_STATUS_OK;
 	}
 
+	/* On close if we're changing the real file time we
+	 * must update it in the open file db too. */
+	(void)set_write_time(fsp->file_id, fsp->close_write_time);
+
 	ft.mtime = fsp->close_write_time;
-	status = smb_set_file_time(fsp->conn, fsp, fsp->fsp_name, &ft, true);
+	status = smb_set_file_time(fsp->conn, fsp, fsp->fsp_name, &ft, false);
 	if (!NT_STATUS_IS_OK(status)) {
 		return status;
 	}
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index a1e7889..66102fa 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -1296,7 +1296,7 @@ static NTSTATUS copy_internals(TALLOC_CTX *ctx,
 	close_file(NULL, fsp1, NORMAL_CLOSE);
 
 	/* Ensure the modtime is set correctly on the destination file. */
-	set_close_write_time(NULL, fsp2, smb_fname_src->st.st_ex_mtime);
+	set_close_write_time(fsp2, smb_fname_src->st.st_ex_mtime);
 
 	status = close_file(NULL, fsp2, NORMAL_CLOSE);
 
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index 37634ac..984cf56 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -4646,7 +4646,7 @@ void reply_close(struct smb_request *req)
 		 */
 
 		t = srv_make_unix_date3(req->vwv+1);
-		set_close_write_time(NULL, fsp, convert_time_t_to_timespec(t));
+		set_close_write_time(fsp, convert_time_t_to_timespec(t));
 
 		/*
 		 * close_file() returns the unix errno if an error
@@ -4723,7 +4723,7 @@ void reply_writeclose(struct smb_request *req)
 
 	nwritten = write_file(req,fsp,data,startpos,numtowrite);
 
-	set_close_write_time(NULL, fsp, mtime);
+	set_close_write_time(fsp, mtime);
 
 	/*
 	 * More insanity. W2K only closes the file if writelen > 0.
@@ -6691,7 +6691,7 @@ NTSTATUS copy_file(TALLOC_CTX *ctx,
 	close_file(NULL, fsp1, NORMAL_CLOSE);
 
 	/* Ensure the modtime is set correctly on the destination file. */
-	set_close_write_time(NULL, fsp2, smb_fname_src->st.st_ex_mtime);
+	set_close_write_time(fsp2, smb_fname_src->st.st_ex_mtime);
 
 	/*
 	 * As we are opening fsp1 read-only we only expect


-- 
Samba Shared Repository


More information about the samba-cvs mailing list