aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/f2fs/checkpoint.c3
-rw-r--r--fs/f2fs/super.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 9f5317c9ad72..231d8c9fea0a 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -1043,7 +1043,8 @@ void write_checkpoint(struct f2fs_sb_info *sbi, struct cp_control *cpc)
1043 1043
1044 mutex_lock(&sbi->cp_mutex); 1044 mutex_lock(&sbi->cp_mutex);
1045 1045
1046 if (!sbi->s_dirty && cpc->reason != CP_DISCARD) 1046 if (!sbi->s_dirty &&
1047 cpc->reason != CP_DISCARD && cpc->reason != CP_UMOUNT)
1047 goto out; 1048 goto out;
1048 if (unlikely(f2fs_cp_error(sbi))) 1049 if (unlikely(f2fs_cp_error(sbi)))
1049 goto out; 1050 goto out;
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 84f95cd4076a..0d627f2d1828 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -447,8 +447,13 @@ static void f2fs_put_super(struct super_block *sb)
447 f2fs_destroy_stats(sbi); 447 f2fs_destroy_stats(sbi);
448 stop_gc_thread(sbi); 448 stop_gc_thread(sbi);
449 449
450 /* We don't need to do checkpoint when it's clean */ 450 /*
451 if (sbi->s_dirty) { 451 * We don't need to do checkpoint when superblock is clean.
452 * But, the previous checkpoint was not done by umount, it needs to do
453 * clean checkpoint again.
454 */
455 if (sbi->s_dirty ||
456 !is_set_ckpt_flags(F2FS_CKPT(sbi), CP_UMOUNT_FLAG)) {
452 struct cp_control cpc = { 457 struct cp_control cpc = {
453 .reason = CP_UMOUNT, 458 .reason = CP_UMOUNT,
454 }; 459 };