[JFFS2] Fix writebuffer recovery in the first page of a block

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Mar 8 05:59:02 EST 2007

Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=180bfb31fef77815d56b875d4f28d353fdc87bf8
Commit:     180bfb31fef77815d56b875d4f28d353fdc87bf8
Parent:     1f92267c51a514f35ad5b0fd46cb099c0980b679
Author:     Vitaly Wool <vwool at ru.mvista.com>
AuthorDate: Tue Mar 6 17:01:04 2007 +0300
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Thu Mar 8 09:18:31 2007 +0000

    [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 at ru.mvista.com>
    Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
 fs/jffs2/wbuf.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/jffs2/wbuf.c b/fs/jffs2/wbuf.c
index de718e3..23028b3 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)
 	jeb = &c->blocks[c->wbuf_ofs / c->sector_size];
-	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);

More information about the linux-mtd-cvs mailing list