mtd/fs/jffs2/ecos/src fs-ecos.c,1.26,1.27

David Woodhouse dwmw2 at infradead.org
Wed Nov 26 17:10:21 EST 2003


Update of /home/cvs/mtd/fs/jffs2/ecos/src
In directory phoenix.infradead.org:/tmp/cvs-serv14917

Modified Files:
	fs-ecos.c 
Log Message:
Fix icount of old and new parent when moving a directory


Index: fs-ecos.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/ecos/src/fs-ecos.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- fs-ecos.c	26 Nov 2003 21:45:41 -0000	1.26
+++ fs-ecos.c	26 Nov 2003 22:10:18 -0000	1.27
@@ -869,7 +869,7 @@
 		}
 
 		// Now delete the destination directory entry
-
+		/* Er, what happened to atomicity of rename()? */
 		err = -jffs2_unlink(ds2.dir, ds2.node, ds2.name);
 
 		if (err != 0)
@@ -890,7 +890,16 @@
  out:
 	jffs2_iput(ds1.dir);
 	jffs2_iput(ds1.node);
-	jffs2_iput(ds2.dir);
+	if (S_ISDIR(ds1.node->i_mode)) {
+		/* Renamed a directory to elsewhere... so fix up its
+		   i_parent pointer and the i_counts of its old and
+		   new parents. */
+		jffs2_iput(ds1.node->i_parent);
+		ds1.node->i_parent = ds2.dir;
+		/* We effectively increase its use count by not... */
+	} else {
+		jffs2_iput(ds2.dir); /* ... doing this */
+	}
 	if (ds2.node)
 		jffs2_iput(ds2.node);
  




More information about the linux-mtd-cvs mailing list