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

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

diff -u --recursive --new-file v2.1.116/linux/fs/vfat/namei.c linux/fs/vfat/namei.c
@@ -1771,8 +1771,6 @@
 	MSDOS_I(new_inode)->i_logstart = MSDOS_I(old_inode)->i_logstart;
 	MSDOS_I(new_inode)->i_attrs = MSDOS_I(old_inode)->i_attrs;
 
-	old_inode->i_nlink = 0;
-
 	fat_cache_inval_inode(old_inode);
 	mark_inode_dirty(new_inode);
 
@@ -1815,6 +1813,16 @@
 		iput(dotdot_inode);
 		fat_brelse(sb, dotdot_bh);
 	}
+
+	/*
+	 * This convinces the VFS layer to drop the old inode,
+	 * but at the same time fools the VFAT layer to not
+	 * actually delete any of the blocks in the old file
+	 * (because they are very much used by the renamed file)
+	 */
+	MSDOS_I(old_inode)->i_start = 0;
+	MSDOS_I(old_inode)->i_logstart = 0;
+	old_inode->i_nlink = 0;
 
 	if (res > 0) res = 0;
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov