If fsck.f2fs reports a bug, move_curseg_info tries to change the current
segment info.
When it changes the new summary block, it overwrites the existing journal
entries.
This patch fixes it not to overwrite journal entry space.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
/* update summary blocks having nullified journal entries */
for (i = 0; i < NO_CHECK_TYPE; i++) {
struct curseg_info *curseg = CURSEG_I(sbi, i);
+ struct f2fs_summary_block buf;
u32 old_segno;
u64 ssa_blk, to;
/* update new segno */
ssa_blk = GET_SUM_BLKADDR(sbi, curseg->segno);
- ret = dev_read_block(curseg->sum_blk, ssa_blk);
+ ret = dev_read_block(&buf, ssa_blk);
ASSERT(ret >= 0);
+ memcpy(curseg->sum_blk, &buf, SUM_ENTRIES_SIZE);
+
/* update se->types */
reset_curseg(sbi, i);