patch-2.2.6 linux/fs/vfat/namei.c

Next file: linux/include/asm-alpha/io.h
Previous file: linux/fs/umsdos/namei.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.5/linux/fs/vfat/namei.c linux/fs/vfat/namei.c
@@ -1570,14 +1570,6 @@
 		 old_dentry, old_dentry->d_inode, old_dentry->d_inode->i_ino,
 		 new_dentry, new_dentry->d_inode,
 		 new_dentry->d_inode ? new_dentry->d_inode->i_ino : 0));
-	/*
-	 * POSIX is braindead (surprise, surprise). It requires that rename()
-	 * should return 0 and do nothing if the target has the same inode as
-	 * the source. Somebody, get a time machine, return to '89 and tell
-	 * RMS & Co *not* to do that idiocy, FAST!
-	 */
-	if (old_dentry->d_inode == new_dentry->d_inode)
-		return 0;
 
 	old_bh = new_bh = NULL;
 	old_inode = new_inode = NULL;
@@ -1597,16 +1589,8 @@
 	old_inode = old_dentry->d_inode;
 	is_dir = S_ISDIR(old_inode->i_mode);
 
-	/*
-	 * Race: we can be hit by another rename after this check.
-	 * For the time being use fat_lock_creation(), but it's
-	 * ugly. FIXME.
-	 */
-
-	fat_lock_creation(); locked = 1;
-
 	if (is_dir) {
-		/* We can't use d_subdir() here. Arrgh. */
+		/* We can't use is_subdir() here. Even now. Arrgh. */
 		for (walk=new_dentry;walk!=walk->d_parent;walk=walk->d_parent) {
 			if (walk->d_inode != old_dentry->d_inode)
 				continue;
@@ -1615,6 +1599,8 @@
 		}
 	}
 
+	fat_lock_creation(); locked = 1;
+
 	if (new_dentry->d_inode) {
 		/*
 		 * OK, we have to remove the target. We should do it so
@@ -1639,8 +1625,6 @@
 			 * be tolerated.
 			 */
 			res = -EBUSY;
-			if (d_invalidate(new_dentry) < 0)
-				goto rename_done;
 			/*
 			 * OK, let's try to get rid of other dentries.
 			 * No need to do it if i_count is 1.
@@ -1726,12 +1710,8 @@
 		fat_brelse(sb, dotdot_bh);
 	}
 
-	if (res >= 0) {
-		if (new_inode && is_dir)
-			d_rehash(new_dentry);
-		d_move(old_dentry, new_dentry);
+	if (res >= 0)
 		res = 0;
-	}
 
 rename_done:
 	if (locked)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)