diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-12-19 23:17:11 -0800 |
---|---|---|
committer | Greg Wallace <greg@gregtwallace.com> | 2016-01-19 22:02:21 -0500 |
commit | 32dd5f4228c996064cd7ca401263fb03b586702a (patch) | |
tree | 3d1e36b771e808e0114df151f4375c98f72abf99 | |
parent | 0516d2ba48d29044bc5d5235cc9d98e77bcb2201 (diff) | |
download | android_external_f2fs-tools-32dd5f4228c996064cd7ca401263fb03b586702a.tar.gz android_external_f2fs-tools-32dd5f4228c996064cd7ca401263fb03b586702a.tar.bz2 android_external_f2fs-tools-32dd5f4228c996064cd7ca401263fb03b586702a.zip |
fsck.f2fs: fix losing journal entries
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.
Change-Id: I99e118eb0e97985348fef212d0fff6b7a161b3a3
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fsck/mount.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fsck/mount.c b/fsck/mount.c index d2f1432..fe68f37 100644 --- a/fsck/mount.c +++ b/fsck/mount.c @@ -1438,6 +1438,7 @@ void move_curseg_info(struct f2fs_sb_info *sbi, u64 from) /* 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; @@ -1457,9 +1458,11 @@ void move_curseg_info(struct f2fs_sb_info *sbi, u64 from) /* 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); |