[Ocfs2-commits] seeda commits r3073 - tags/ocfs2-1.2.7/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Nov 20 20:21:13 PST 2007


Author: seeda
Date: 2007-11-20 20:21:13 -0800 (Tue, 20 Nov 2007)
New Revision: 3073

Modified:
   tags/ocfs2-1.2.7/fs/ocfs2/namei.c
Log:
ocfs2: fix rename vs unlink race

If another node unlinks the destination while ocfs2_rename() is waiting on a
cluster lock, ocfs2_rename() simply logs an error and continues. This causes
a crash because the renaming node is now trying to delete a non-existent
inode. The correct solution is to return -ENOENT.

Signed-off-by: smushran



Modified: tags/ocfs2-1.2.7/fs/ocfs2/namei.c
===================================================================
--- tags/ocfs2-1.2.7/fs/ocfs2/namei.c	2007-11-21 04:19:01 UTC (rev 3072)
+++ tags/ocfs2-1.2.7/fs/ocfs2/namei.c	2007-11-21 04:21:13 UTC (rev 3073)
@@ -1151,9 +1151,16 @@
 		goto bail;
 	}
 
-	if (!new_de && new_inode)
-		mlog(ML_ERROR, "inode %lu does not exist in it's parent "
-		     "directory!", new_inode->i_ino);
+	if (!new_de && new_inode) {
+		/*
+		 * Target was unlinked by another node while we were
+		 * waiting to get to ocfs2_rename(). There isn't
+		 * anything we can do here to help the situation, so
+		 * bubble up the appropriate error.
+		 */
+		status = -ENOENT;
+		goto bail;
+	}
 
 	/* In case we need to overwrite an existing file, we blow it
 	 * away first */




More information about the Ocfs2-commits mailing list