svn commit: samba r23483 - in branches: SAMBA_3_0/source/smbd SAMBA_3_0_26/source/smbd

vlendec at samba.org vlendec at samba.org
Thu Jun 14 09:51:17 GMT 2007


Author: vlendec
Date: 2007-06-14 09:51:13 +0000 (Thu, 14 Jun 2007)
New Revision: 23483

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23483

Log:
Revert 23482, I must have run 'make test' in the wrong subdir.


Modified:
   branches/SAMBA_3_0/source/smbd/reply.c
   branches/SAMBA_3_0_26/source/smbd/reply.c


Changeset:
Modified: branches/SAMBA_3_0/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0/source/smbd/reply.c	2007-06-14 09:45:39 UTC (rev 23482)
+++ branches/SAMBA_3_0/source/smbd/reply.c	2007-06-14 09:51:13 UTC (rev 23483)
@@ -4168,15 +4168,13 @@
  asynchronously.
 ****************************************************************************/
 
-static void rename_open_files(connection_struct *conn,
-			      struct share_mode_lock *lck,
-			      const char *newname)
+static void rename_open_files(connection_struct *conn, struct share_mode_lock *lck,
+			      struct file_id id, const char *newname)
 {
 	files_struct *fsp;
 	BOOL did_rename = False;
 
-	for(fsp = file_find_di_first(lck->id); fsp;
-	    fsp = file_find_di_next(fsp)) {
+	for(fsp = file_find_di_first(id); fsp; fsp = file_find_di_next(fsp)) {
 		/* fsp_name is a relative path under the fsp. To change this for other
 		   sharepaths we need to manipulate relative paths. */
 		/* TODO - create the absolute path and manipulate the newname
@@ -4193,7 +4191,7 @@
 
 	if (!did_rename) {
 		DEBUG(10,("rename_open_files: no open files on file_id %s for %s\n",
-			  file_id_static_string(&lck->id), newname ));
+			  file_id_static_string(&id), newname ));
 	}
 
 	/* Send messages to all smbd's (not ourself) that the name has changed. */
@@ -4239,6 +4237,7 @@
 	SMB_STRUCT_STAT sbuf;
 	pstring newname_last_component;
 	NTSTATUS status = NT_STATUS_OK;
+	BOOL dest_exists;
 	struct share_mode_lock *lck = NULL;
 
 	ZERO_STRUCT(sbuf);
@@ -4307,7 +4306,9 @@
 		return NT_STATUS_OK;
 	}
 
-	if(!replace_if_exists && vfs_object_exist(conn, newname, NULL)) {
+	dest_exists = vfs_object_exist(conn,newname,NULL);
+
+	if(!replace_if_exists && dest_exists) {
 		DEBUG(3,("rename_internals_fsp: dest exists doing rename %s -> %s\n",
 			fsp->fsp_name,newname));
 		return NT_STATUS_OBJECT_NAME_COLLISION;
@@ -4346,7 +4347,7 @@
 		DEBUG(3,("rename_internals_fsp: succeeded doing rename on %s -> %s\n",
 			fsp->fsp_name,newname));
 
-		rename_open_files(conn, lck, newname);
+		rename_open_files(conn, lck, fsp->file_id, newname);
 
 		/*
 		 * A rename acts as a new file create w.r.t. allowing an initial delete
@@ -4454,6 +4455,7 @@
 	const char *dname;
 	long offset = 0;
 	pstring destname;
+	struct file_id id;
 
 	*directory = *mask = 0;
 
@@ -4603,6 +4605,8 @@
 		 * don't do the rename, just return success.
 		 */
 
+		id = file_id_sbuf(&sbuf1);
+
 		if (strcsequal(directory, newname)) {
 			DEBUG(3, ("rename_internals: identical names in "
 				  "rename %s - returning success\n",
@@ -4620,13 +4624,12 @@
 			return NT_STATUS_SHARING_VIOLATION;
 		}
 
-		lck = get_share_mode_lock(NULL, file_id_sbuf(&sbuf1),
-					  NULL, NULL);
+		lck = get_share_mode_lock(NULL, id, NULL, NULL);
 
 		if(SMB_VFS_RENAME(conn,directory, newname) == 0) {
 			DEBUG(3,("rename_internals: succeeded doing rename "
 				 "on %s -> %s\n", directory, newname));
-			rename_open_files(conn, lck, newname);
+			rename_open_files(conn, lck, id, newname);
 			TALLOC_FREE(lck);
 			notify_rename(conn, S_ISDIR(sbuf1.st_mode),
 				      directory, newname);
@@ -4737,6 +4740,8 @@
 			return status;
 		}
 
+		id = file_id_sbuf(&sbuf1);
+
 		if (strcsequal(fname,destname)) {
 			DEBUG(3,("rename_internals: identical names "
 				 "in wildcard rename %s - success\n",
@@ -4756,11 +4761,10 @@
 			return NT_STATUS_SHARING_VIOLATION;
 		}
 
-		lck = get_share_mode_lock(NULL, file_id_sbuf(&sbuf1), NULL,
-					  NULL);
+		lck = get_share_mode_lock(NULL, id, NULL, NULL);
 
 		if (!SMB_VFS_RENAME(conn,fname,destname)) {
-			rename_open_files(conn, lck, newname);
+			rename_open_files(conn, lck, id, newname);
 			count++;
 			status = NT_STATUS_OK;
 		}

Modified: branches/SAMBA_3_0_26/source/smbd/reply.c
===================================================================
--- branches/SAMBA_3_0_26/source/smbd/reply.c	2007-06-14 09:45:39 UTC (rev 23482)
+++ branches/SAMBA_3_0_26/source/smbd/reply.c	2007-06-14 09:51:13 UTC (rev 23483)
@@ -4166,15 +4166,13 @@
  asynchronously.
 ****************************************************************************/
 
-static void rename_open_files(connection_struct *conn,
-			      struct share_mode_lock *lck,
-			      const char *newname)
+static void rename_open_files(connection_struct *conn, struct share_mode_lock *lck,
+			      struct file_id id, const char *newname)
 {
 	files_struct *fsp;
 	BOOL did_rename = False;
 
-	for(fsp = file_find_di_first(lck->id); fsp;
-	    fsp = file_find_di_next(fsp)) {
+	for(fsp = file_find_di_first(id); fsp; fsp = file_find_di_next(fsp)) {
 		/* fsp_name is a relative path under the fsp. To change this for other
 		   sharepaths we need to manipulate relative paths. */
 		/* TODO - create the absolute path and manipulate the newname
@@ -4191,7 +4189,7 @@
 
 	if (!did_rename) {
 		DEBUG(10,("rename_open_files: no open files on file_id %s for %s\n",
-			  file_id_static_string(&lck->id), newname ));
+			  file_id_static_string(&id), newname ));
 	}
 
 	/* Send messages to all smbd's (not ourself) that the name has changed. */
@@ -4237,6 +4235,7 @@
 	SMB_STRUCT_STAT sbuf;
 	pstring newname_last_component;
 	NTSTATUS status = NT_STATUS_OK;
+	BOOL dest_exists;
 	struct share_mode_lock *lck = NULL;
 
 	ZERO_STRUCT(sbuf);
@@ -4305,7 +4304,9 @@
 		return NT_STATUS_OK;
 	}
 
-	if(!replace_if_exists && vfs_object_exist(conn, newname, NULL)) {
+	dest_exists = vfs_object_exist(conn,newname,NULL);
+
+	if(!replace_if_exists && dest_exists) {
 		DEBUG(3,("rename_internals_fsp: dest exists doing rename %s -> %s\n",
 			fsp->fsp_name,newname));
 		return NT_STATUS_OBJECT_NAME_COLLISION;
@@ -4344,7 +4345,7 @@
 		DEBUG(3,("rename_internals_fsp: succeeded doing rename on %s -> %s\n",
 			fsp->fsp_name,newname));
 
-		rename_open_files(conn, lck, newname);
+		rename_open_files(conn, lck, fsp->file_id, newname);
 
 		/*
 		 * A rename acts as a new file create w.r.t. allowing an initial delete
@@ -4452,6 +4453,7 @@
 	const char *dname;
 	long offset = 0;
 	pstring destname;
+	struct file_id id;
 
 	*directory = *mask = 0;
 
@@ -4601,6 +4603,8 @@
 		 * don't do the rename, just return success.
 		 */
 
+		id = file_id_sbuf(&sbuf1);
+
 		if (strcsequal(directory, newname)) {
 			DEBUG(3, ("rename_internals: identical names in "
 				  "rename %s - returning success\n",
@@ -4618,13 +4622,12 @@
 			return NT_STATUS_SHARING_VIOLATION;
 		}
 
-		lck = get_share_mode_lock(NULL, file_id_sbuf(&sbuf1),
-					  NULL, NULL);
+		lck = get_share_mode_lock(NULL, id, NULL, NULL);
 
 		if(SMB_VFS_RENAME(conn,directory, newname) == 0) {
 			DEBUG(3,("rename_internals: succeeded doing rename "
 				 "on %s -> %s\n", directory, newname));
-			rename_open_files(conn, lck, newname);
+			rename_open_files(conn, lck, id, newname);
 			TALLOC_FREE(lck);
 			notify_rename(conn, S_ISDIR(sbuf1.st_mode),
 				      directory, newname);
@@ -4735,6 +4738,8 @@
 			return status;
 		}
 
+		id = file_id_sbuf(&sbuf1);
+
 		if (strcsequal(fname,destname)) {
 			DEBUG(3,("rename_internals: identical names "
 				 "in wildcard rename %s - success\n",
@@ -4754,11 +4759,10 @@
 			return NT_STATUS_SHARING_VIOLATION;
 		}
 
-		lck = get_share_mode_lock(NULL, file_id_sbuf(&sbuf1), NULL,
-					  NULL);
+		lck = get_share_mode_lock(NULL, id, NULL, NULL);
 
 		if (!SMB_VFS_RENAME(conn,fname,destname)) {
-			rename_open_files(conn, lck, newname);
+			rename_open_files(conn, lck, id, newname);
 			count++;
 			status = NT_STATUS_OK;
 		}



More information about the samba-cvs mailing list