reply_unlink

Nadav Danieli nadavd at exanet.com
Wed Nov 23 20:40:26 GMT 2005


On Wed, 2005-11-23 at 01:28, Jeremy Allison wrote:

> 
> If you have a fix please send in a patch so I can examine it.
> 
> Thanks,
> 
> 	Jeremy.

After this change I have noticed a little difference in the behavior of
samba with the test (smbtorture -N 5 TORTURE)
Some of the delete requests return sharing violation error and no only
name not found. But it seems reasonable to get this error when several
clients do it at once.
With all tests I have made ver. 3.0.7 sources before and after the
change, and latest 3.0.20b sources, the test is most likely hang at the
end, even though it looks like everything is done including file
cleanup. Only very few test finished completely.
Never happened with 2003 server, so someone might want to see why.

-------------- next part --------------
--- smbd/reply.c.orig	2005-11-23 02:18:07.000000000 +0200
+++ smbd/reply.c	2005-11-23 02:49:08.000000000 +0200
@@ -1526,7 +1526,7 @@
 	unix_ERR_class = 0;
 	unix_ERR_code = 0;
 
-	fsp = open_file_shared1(conn, fname, &sbuf, DELETE_ACCESS, SET_DENY_MODE(DENY_ALL),
+	fsp = open_file_shared1(conn, fname, &sbuf, DELETE_ACCESS, SET_DENY_MODE(DENY_ALL)|DELETE_ON_CLOSE_FLAG,
 		(FILE_FAIL_IF_NOT_EXIST|FILE_EXISTS_OPEN), FILE_ATTRIBUTE_NORMAL, 0, &access_mode, &smb_action);
 
 	if (!fsp) {
@@ -1540,7 +1540,7 @@
 		unix_ERR_ntstatus = NT_STATUS_OK;
 		return ret;
 	}
-	close_file(fsp,False);
+	close_file(fsp,True);
 	return NT_STATUS_OK;
 }
 
@@ -1604,9 +1604,7 @@
 		if (!NT_STATUS_IS_OK(error))
 			return error;
 
-		if (SMB_VFS_UNLINK(conn,directory) == 0) {
-			count++;
-		}
+		count++;
 	} else {
 		void *dirptr = NULL;
 		const char *dname;
@@ -1656,8 +1654,7 @@
 				if (!NT_STATUS_IS_OK(error)) {
 					continue;
 				}
-				if (SMB_VFS_UNLINK(conn,fname) == 0)
-					count++;
+				count++;
 				DEBUG(3,("unlink_internals: succesful unlink [%s]\n",fname));
 			}
 			CloseDir(dirptr);


More information about the samba-technical mailing list