f2fs: check end_io for metapages before making next checkpoint blocks
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 16 Sep 2015 21:06:54 +0000 (14:06 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 9 Oct 2015 23:20:51 +0000 (16:20 -0700)
This patch avoids to produce new checkpoint blocks before the previous meta
pages were written completely.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/checkpoint.c

index c5a38e352a80952dc833c5740eec11f64eadec59..ff53405aee39e47094882bac8e90e02dc0802768 100644 (file)
@@ -1000,6 +1000,11 @@ static void do_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
 
        start_blk = __start_cp_addr(sbi);
 
+       /* need to wait for end_io results */
+       wait_on_all_pages_writeback(sbi);
+       if (unlikely(f2fs_cp_error(sbi)))
+               return;
+
        /* write out checkpoint buffer at block 0 */
        update_meta_page(sbi, ckpt, start_blk++);