JFFS2 list_dirty corruption

Thomas Gleixner gleixner at autronix.de
Wed Feb 20 19:26:34 EST 2002


On Thursday, 21. February 2002 00:58, Adam Wozniak wrote:
> Ok, maybe this is a problem:
>
Sorry, you're right. I should send such mails better in the morning.
It happened on the transcript from my NAND modified stuff.
Here is the correct patch:

--- mtd/fs/jffs2/scan.c	2002/01/09 13:25:58	1.57
+++ mtd/fs/jffs2/scan.c	2002/02/21 00:17:19
@@ -127,10 +127,17 @@
                         if (jeb->free_size > 2*sizeof(struct 
jffs2_raw_inode) &&
                                 (!c->nextblock || c->nextblock->free_size < 
jeb->free_size)) {
                                 /* Better candidate for the next writes to 
go to */
-                                if (c->nextblock)
+                                if (c->nextblock) {
+					/* We must delete, because mark_node_obsolete
+					   could have added this block to dirty_list already */
+                                        list_del(&c->nextblock->list);
                                         list_add(&c->nextblock->list, 
&c->dirty_list);
+				}
                                 c->nextblock = jeb;
                         } else {
+				/* We must delete, because mark_node_obsolete
+				   could have added this block to dirty_list already */
+				list_del(&jeb->list);
                                 list_add(&jeb->list, &c->dirty_list);
                         }
 		} else {
-- 
Thomas
P.S. David: The jffs2-nand-version is correct.
__________________________________________________
Thomas Gleixner, autronix automation GmbH
auf dem berg 3, d-88690 uhldingen-muehlhofen
fon: +49 7556 919891 , fax: +49 7556 919886
mail: gleixner at autronix.de, http://www.autronix.de  




More information about the linux-mtd mailing list