[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Jul 12 13:29:01 MDT 2012


The branch, master has been updated
       via  622eb59 s3: Make us survive base-delaywrite with aio enabled
       via  67e7e14 s3: Factor out "mark_file_modified"
      from  1ee95e4 s3: rename sid_check_is_in_our_domain() to sid_check_is_in_our_sam()

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


- Log -----------------------------------------------------------------
commit 622eb59eb472bbdb9fd985c4d8880d3a1c098cd7
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 12 18:47:42 2012 +0200

    s3: Make us survive base-delaywrite with aio enabled
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Jul 12 21:28:19 CEST 2012 on sn-devel-104

commit 67e7e14e6231b420d34b9782cfac7901c2e28663
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jul 12 16:28:11 2012 +0200

    s3: Factor out "mark_file_modified"
    
    This is in preparation of making us survive base-delaywrite with async I/O activated
    
    Signed-off-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 source3/smbd/aio.c    |    4 +++
 source3/smbd/fileio.c |   67 ++++++++++++++++++++++++++++++------------------
 source3/smbd/proto.h  |    1 +
 3 files changed, 47 insertions(+), 25 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index ec68b90..0ea5274 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -733,6 +733,8 @@ static int handle_aio_write_complete(struct aio_extra *aio_ex, int errcode)
 		}
 
 		aio_ex->fsp->fh->pos = aio_ex->acb.aio_offset + nwritten;
+
+		mark_file_modified(aio_ex->fsp);
 	}
 
 	show_msg(outbuf);
@@ -821,6 +823,8 @@ static int handle_aio_smb2_write_complete(struct aio_extra *aio_ex, int errcode)
 		return errcode;
 	}
 
+	mark_file_modified(fsp);
+
 	tevent_req_done(subreq);
 	return errcode;
 }
diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c
index a14be78..631a9a1 100644
--- a/source3/smbd/fileio.c
+++ b/source3/smbd/fileio.c
@@ -269,6 +269,37 @@ void trigger_write_time_update_immediate(struct files_struct *fsp)
 	(void)smb_set_file_time(fsp->conn, fsp, fsp->fsp_name, &ft, false);
 }
 
+void mark_file_modified(files_struct *fsp)
+{
+	int dosmode;
+
+	if (fsp->modified) {
+		return;
+	}
+
+	fsp->modified = true;
+
+	if (SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) != 0) {
+		return;
+	}
+	trigger_write_time_update(fsp);
+
+	if (fsp->posix_open) {
+		return;
+	}
+	if (!(lp_store_dos_attributes(SNUM(fsp->conn)) ||
+	      MAP_ARCHIVE(fsp->conn))) {
+		return;
+	}
+
+	dosmode = dos_mode(fsp->conn, fsp->fsp_name);
+	if (IS_DOS_ARCHIVE(dosmode)) {
+		return;
+	}
+	file_set_dosmode(fsp->conn, fsp->fsp_name,
+			 dosmode | FILE_ATTRIBUTE_ARCHIVE, NULL, false);
+}
+
 /****************************************************************************
  Write to a file.
 ****************************************************************************/
@@ -300,34 +331,20 @@ ssize_t write_file(struct smb_request *req,
 		return -1;
 	}
 
-	if (!fsp->modified) {
-		fsp->modified = True;
-
-		if (SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st) == 0) {
-			trigger_write_time_update(fsp);
-			if (!fsp->posix_open &&
-					(lp_store_dos_attributes(SNUM(fsp->conn)) ||
-					MAP_ARCHIVE(fsp->conn))) {
-				int dosmode = dos_mode(fsp->conn, fsp->fsp_name);
-				if (!IS_DOS_ARCHIVE(dosmode)) {
-					file_set_dosmode(fsp->conn, fsp->fsp_name,
-						 dosmode | FILE_ATTRIBUTE_ARCHIVE, NULL, false);
-				}
-			}
-
-			/*
-			 * If this is the first write and we have an exclusive oplock then setup
-			 * the write cache.
-			 */
+	/*
+	 * If this is the first write and we have an exclusive oplock
+	 * then setup the write cache.
+	 */
 
-			if (EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) && !wcp) {
-				setup_write_cache(fsp,
-						 fsp->fsp_name->st.st_ex_size);
-				wcp = fsp->wcp;
-			}
-		}
+	if (!fsp->modified &&
+	    EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type) &&
+	    (wcp == NULL)) {
+		setup_write_cache(fsp, fsp->fsp_name->st.st_ex_size);
+		wcp = fsp->wcp;
 	}
 
+	mark_file_modified(fsp);
+
 #ifdef WITH_PROFILE
 	DO_PROFILE_INC(writecache_total_writes);
 	if (!fsp->oplock_type) {
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 725f89c..9aaa00a 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -320,6 +320,7 @@ void update_write_time_handler(struct event_context *ctx,
                                       void *private_data);
 void trigger_write_time_update(struct files_struct *fsp);
 void trigger_write_time_update_immediate(struct files_struct *fsp);
+void mark_file_modified(files_struct *fsp);
 ssize_t write_file(struct smb_request *req,
 			files_struct *fsp,
 			const char *data,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list