cifs backport is current

Jeremy Allison jra at samba.org
Tue Jul 17 00:10:57 GMT 2007


On Mon, Jul 16, 2007 at 03:39:25PM -0500, Steve French wrote:
> Yes - that worked fine.  Now I can open a file again, and reproduce
> the original problem "rm -r" fails (posix unlink leaves debris around
> - in the cleanup phase of connectathon test 8 which is cleaning up 10
> symlinks ).
> 
> This is easy to reproduce - create a symlink somewhere within the
> share - then try to remove it from a cifs mount with cifs 1.50 or
> greater (which uses the new posix unlink). The posix unlink succeeds
> (NT Status code is zero) but the symlink is left around.   Removing a
> file works.

Fixed this in SAMBA_3_2, SAMBA_3_2_0 and SAMBA_3_0_25 - will be
fixed for 3.0.25c. Bug was in delete on close semantics for
POSIX symlinks. Patch attached (in case you're interested :-).

Jeremy.
-------------- next part --------------
Index: smbd/close.c
===================================================================
--- smbd/close.c	(revision 23905)
+++ smbd/close.c	(working copy)
@@ -154,6 +154,7 @@
 	struct share_mode_lock *lck;
 	SMB_STRUCT_STAT sbuf;
 	NTSTATUS status = NT_STATUS_OK;
+	int ret;
 	struct file_id id;
 
 	/*
@@ -247,8 +248,14 @@
 
 	/* We can only delete the file if the name we have is still valid and
 	   hasn't been renamed. */
-	
-	if(SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf) != 0) {
+
+	if (fsp->posix_open) {
+		ret = SMB_VFS_LSTAT(conn,fsp->fsp_name,&sbuf);
+	} else {
+		ret = SMB_VFS_STAT(conn,fsp->fsp_name,&sbuf);
+	}
+
+	if (ret != 0) {
 		DEBUG(5,("close_remove_share_mode: file %s. Delete on close "
 			 "was set and stat failed with error %s\n",
 			 fsp->fsp_name, strerror(errno) ));


More information about the samba-technical mailing list