aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorEstelle Hammache <estelle.hammache@st.com>2005-01-24 16:30:25 -0500
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 06:14:34 -0400
commit3118db3dfe7c16284d1d578e628fd87639b00731 (patch)
treea0bd21784ca0dfd95f4713c4d649a37b5f531371 /fs
parent7f716cf3f9cc9dd420b9c75071559017812df6d2 (diff)
[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 <estelle.hammache@st.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/jffs2/nodemgmt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
index 2651135bdf42..b2a53879d3b9 100644
--- a/fs/jffs2/nodemgmt.c
+++ b/fs/jffs2/nodemgmt.c
@@ -7,7 +7,7 @@
7 * 7 *
8 * For licensing information, see the file 'LICENCE' in this directory. 8 * For licensing information, see the file 'LICENCE' in this directory.
9 * 9 *
10 * $Id: nodemgmt.c,v 1.115 2004/11/22 11:07:21 dwmw2 Exp $ 10 * $Id: nodemgmt.c,v 1.116 2005/01/24 21:30:22 hammache Exp $
11 * 11 *
12 */ 12 */
13 13
@@ -308,7 +308,10 @@ int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_r
308 308
309 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)); 309 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));
310#if 1 310#if 1
311 if (jeb != c->nextblock || (ref_offset(new)) != jeb->offset + (c->sector_size - jeb->free_size)) { 311 /* we could get some obsolete nodes after nextblock was refiled
312 in wbuf.c */
313 if ( (c->nextblock || !ref_obsolete(new))
314 &&(jeb != c->nextblock || (ref_offset(new)) != jeb->offset + (c->sector_size - jeb->free_size))) {
312 printk(KERN_WARNING "argh. node added in wrong place\n"); 315 printk(KERN_WARNING "argh. node added in wrong place\n");
313 jffs2_free_raw_node_ref(new); 316 jffs2_free_raw_node_ref(new);
314 return -EINVAL; 317 return -EINVAL;
@@ -332,7 +335,7 @@ int jffs2_add_physical_node_ref(struct jffs2_sb_info *c, struct jffs2_raw_node_r
332 c->used_size += len; 335 c->used_size += len;
333 } 336 }
334 337
335 if (!jeb->free_size && !jeb->dirty_size) { 338 if (!jeb->free_size && !jeb->dirty_size && !jeb->wasted_size) {
336 /* If it lives on the dirty_list, jffs2_reserve_space will put it there */ 339 /* If it lives on the dirty_list, jffs2_reserve_space will put it there */
337 D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n", 340 D1(printk(KERN_DEBUG "Adding full erase block at 0x%08x to clean_list (free 0x%08x, dirty 0x%08x, used 0x%08x\n",
338 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size)); 341 jeb->offset, jeb->free_size, jeb->dirty_size, jeb->used_size));