aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/wbuf.c
diff options
context:
space:
mode:
authorVitaly Wool <vwool@ru.mvista.com>2007-03-06 09:01:04 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2007-03-08 04:18:31 -0500
commit180bfb31fef77815d56b875d4f28d353fdc87bf8 (patch)
tree67a7fbae2581e97639473d76dc5a359556c090db /fs/jffs2/wbuf.c
parent1f92267c51a514f35ad5b0fd46cb099c0980b679 (diff)
[JFFS2] Fix writebuffer recovery in the first page of a block
For the case when nand_write_page fail with -EIO for the first page in an eraseblock, jffs2_wbuf_recover ends up producing a BUG in jffs2_block_refile as jeb->first_node is not yet set up (it's set up later in jffs2_wbuf_recover). This BUG is not really a bug; it's just jffs2_wbuf_recover calling jffs2_block_refile with the wrong second parameter. This patch takes care of this situation. Signed-off-by: Vitaly Wool <vwool@ru.mvista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'fs/jffs2/wbuf.c')
-rw-r--r--fs/jffs2/wbuf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index de718e3a1692..23028b384418 100644
--- a/fs/jffs2/wbuf.c
+++ b/fs/jffs2/wbuf.c
@@ -238,7 +238,10 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
238 jeb = &c->blocks[c->wbuf_ofs / c->sector_size]; 238 jeb = &c->blocks[c->wbuf_ofs / c->sector_size];
239 239
240 spin_lock(&c->erase_completion_lock); 240 spin_lock(&c->erase_completion_lock);
241 jffs2_block_refile(c, jeb, REFILE_NOTEMPTY); 241 if (c->wbuf_ofs % c->mtd->erasesize)
242 jffs2_block_refile(c, jeb, REFILE_NOTEMPTY);
243 else
244 jffs2_block_refile(c, jeb, REFILE_ANYWAY);
242 spin_unlock(&c->erase_completion_lock); 245 spin_unlock(&c->erase_completion_lock);
243 246
244 BUG_ON(!ref_obsolete(jeb->last_node)); 247 BUG_ON(!ref_obsolete(jeb->last_node));