mtd/fs/jffs2 build.c,1.35,1.36

David Woodhouse dwmw2 at infradead.org
Wed Aug 7 14:37:34 EDT 2002


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

Modified Files:
	build.c 
Log Message:
Don't bitch about directories with nlink 0 having children, if all the 
children are deletion dirents. Fix memory leak on error case too.


Index: build.c
===================================================================
RCS file: /home/cvs/mtd/fs/jffs2/build.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- build.c	20 May 2002 14:56:37 -0000	1.35
+++ build.c	7 Aug 2002 18:37:32 -0000	1.36
@@ -225,20 +225,33 @@
 	}
 
 	if (ic->scan->dents) {
-		printk(KERN_NOTICE "Inode #%u was a directory with children - removing those too...\n", ic->ino);
-	
+		int whinged = 0;
+		D1(printk(KERN_DEBUG "Inode #%u was a directory which may have children...\n", ic->ino));
+
 		while(ic->scan->dents) {
 			struct jffs2_inode_cache *child_ic;
 
 			fd = ic->scan->dents;
 			ic->scan->dents = fd->next;
 
+			if (!fd->ino) {
+				/* It's a deletion dirent. Ignore it */
+				D1(printk(KERN_DEBUG "Child \"%s\" is a deletion dirent, skipping...\n", fd->name));
+				jffs2_free_full_dirent(fd);
+				continue;
+			}
+			if (!whinged) {
+				whinged = 1;
+				printk(KERN_NOTICE "Inode #%u was a directory with children - removing those too...\n", ic->ino);
+			}
+
 			D1(printk(KERN_DEBUG "Removing child \"%s\", ino #%u\n",
 				  fd->name, fd->ino));
 			
 			child_ic = jffs2_get_ino_cache(c, fd->ino);
 			if (!child_ic) {
 				printk(KERN_NOTICE "Cannot remove child \"%s\", ino #%u, because it doesn't exist\n", fd->name, fd->ino);
+				jffs2_free_full_dirent(fd);
 				continue;
 			}
 			jffs2_free_full_dirent(fd);





More information about the linux-mtd-cvs mailing list