f2fs-tools: advise to mount unclean image to replay journal
authorChao Yu <yuchao0@huawei.com>
Fri, 9 Aug 2019 10:53:00 +0000 (18:53 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 27 Aug 2019 21:51:05 +0000 (14:51 -0700)
For defrag, resize, sload tools, let's advise to mount unclean
image to replay journal first in order to not lose any fsynced
data.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fsck/mount.c

index 93e6fa2..95bbe0f 100644 (file)
@@ -2962,6 +2962,12 @@ int f2fs_do_mount(struct f2fs_sb_info *sbi)
        }
        cp = F2FS_CKPT(sbi);
 
+       if (c.func != FSCK && c.func != DUMP &&
+               !is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG)) {
+               ERR_MSG("Mount unclean image to replay log first\n");
+               return -1;
+       }
+
        print_ckpt_info(sbi);
 
        if (c.quota_fix) {