Skip to content

Commit

Permalink
[JFFS2] Fix writebuffer recovery in the first page of a block
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Vitaly Wool authored and David Woodhouse committed Mar 8, 2007
1 parent 1f92267 commit 180bfb3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/jffs2/wbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
jeb = &c->blocks[c->wbuf_ofs / c->sector_size];

spin_lock(&c->erase_completion_lock);
jffs2_block_refile(c, jeb, REFILE_NOTEMPTY);
if (c->wbuf_ofs % c->mtd->erasesize)
jffs2_block_refile(c, jeb, REFILE_NOTEMPTY);
else
jffs2_block_refile(c, jeb, REFILE_ANYWAY);
spin_unlock(&c->erase_completion_lock);

BUG_ON(!ref_obsolete(jeb->last_node));
Expand Down

0 comments on commit 180bfb3

Please sign in to comment.