tree a0bd21784ca0dfd95f4713c4d649a37b5f531371
parent 7f716cf3f9cc9dd420b9c75071559017812df6d2
author Estelle Hammache <[EMAIL PROTECTED]> Mon, 24 Jan 2005 21:30:25 +0000
committer Thomas Gleixner <[EMAIL PROTECTED]> Mon, 23 May 2005 12:14:34 +0200
[JFFS2] Fix refile of blocks due to write failure.
avoid segfault when nextblock was refiled because of a write failure
- avoid filing blocks on the clean list when they have wasted
space
Signed-off-by: Estelle Hammache <[EMAIL PROTECTED]>
Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
fs/jffs2/nodemgmt.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -7,7 +7,7 @@
*
* For licensing information, see the file 'LICENCE' in this directory.
*
- * $Id: nodemgmt.c,v 1.115 2004/11/22 11:07:21 dwmw2 Exp $
+ * $Id: nodemgmt.c,v 1.116 2005/01/24 21:30:22 hammache Exp $
*
*/
@@ -308,7 +308,10 @@ int jffs2_add_physical_node_ref(struct j
D1(printk(KERN_DEBUG "jffs2_add_physical_node_ref(): Node at 0x%x(%d),
size 0x%x\n", ref_offset(new), ref_flags(new), len));
#if 1
- if (jeb != c->nextblock || (ref_offset(new)) != jeb->offset +
(c->sector_size - jeb->free_size)) {
+ /* we could get some obsolete nodes after nextblock was refiled
+ in wbuf.c */
+ if ( (c->nextblock || !ref_obsolete(new))
+ &&(jeb != c->nextblock || (ref_offset(new)) != jeb->offset +
(c->sector_size - jeb->free_size))) {
printk(KERN_WARNING "argh. node added in wrong place\n");
jffs2_free_raw_node_ref(new);
return -EINVAL;
@@ -332,7 +335,7 @@ int jffs2_add_physical_node_ref(struct j
c->used_size += len;
}
- if (!jeb->free_size && !jeb->dirty_size) {
+ if (!jeb->free_size && !jeb->dirty_size && !jeb->wasted_size) {
/* If it lives on the dirty_list, jffs2_reserve_space will put
it there */
D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to
clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
jeb->offset, jeb->free_size, jeb->dirty_size,
jeb->used_size));
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html