[PATCH] JFFS2: SUMMARY: fix a summary collecting bug
authorZoltan Sogor <[email protected]>
Sat, 16 Sep 2006 19:15:59 +0000 (12:15 -0700)
committerLinus Torvalds <[email protected]>
Sat, 16 Sep 2006 19:54:32 +0000 (12:54 -0700)
In some special case (padding because of sync or umount) it can be possible
that summary information is not fit to the end of the erase block.  In
these cases the collecting of summary is disabled for this erase block.

The problem was that this was not respected by jffs2_sum_add_kvec().  This
patch fix this bug.

Signed-off-by: Ferenc Havasi <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/jffs2/summary.c

index c19bd476e8ec785abbdcaf9edc9c9ff2e0446678..e52cef526d90e8161e162adbc9727fbf262ddfdd 100644 (file)
@@ -252,6 +252,11 @@ int jffs2_sum_add_kvec(struct jffs2_sb_info *c, const struct kvec *invecs,
        union jffs2_node_union *node;
        struct jffs2_eraseblock *jeb;
 
+       if (c->summary->sum_size == JFFS2_SUMMARY_NOSUM_SIZE) {
+               dbg_summary("Summary is disabled for this jeb! Skipping summary info!\n");
+               return 0;
+       }
+
        node = invecs[0].iov_base;
        jeb = &c->blocks[ofs / c->sector_size];
        ofs -= jeb->offset;