f2fs: fix wrong checkpoint_changed value in f2fs_remount() 62/266762/1 accepted/tizen_6.5_unified tizen_6.5 accepted/tizen/6.5/unified/20211121.212438 accepted/tizen/unified/20211119.134218 submit/tizen/20211117.113146 submit/tizen_6.5/20211119.012519
authorChao Yu <chao@kernel.org>
Thu, 18 Nov 2021 06:35:20 +0000 (15:35 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 18 Nov 2021 08:47:12 +0000 (17:47 +0900)
In f2fs_remount(), return value of test_opt() is an unsigned int type
variable, however when we compare it to a bool type variable, it cause
wrong result, fix it.

Fixes: 4354994f097d ("f2fs: checkpoint disabling")
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
[dwoo08.lee: backport from mainline commit 277afbde6ca2]
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
Change-Id: Icd4dfff441bf84f605d8d09de7be89da88548654

fs/f2fs/super.c

index dacb3bc..071d602 100644 (file)
@@ -1487,8 +1487,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
        bool need_restart_gc = false;
        bool need_stop_gc = false;
        bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE);
-       bool disable_checkpoint = test_opt(sbi, DISABLE_CHECKPOINT);
-       bool checkpoint_changed;
+       bool enable_checkpoint = !test_opt(sbi, DISABLE_CHECKPOINT);
 #ifdef CONFIG_QUOTA
        int i, j;
 #endif
@@ -1533,8 +1532,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
        err = parse_options(sb, data);
        if (err)
                goto restore_opts;
-       checkpoint_changed =
-               disable_checkpoint != test_opt(sbi, DISABLE_CHECKPOINT);
+
 
        /*
         * Previous and new state of filesystem is RO,
@@ -1603,7 +1601,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
                clear_sbi_flag(sbi, SBI_IS_CLOSE);
        }
 
-       if (checkpoint_changed) {
+       if (enable_checkpoint == !!test_opt(sbi, DISABLE_CHECKPOINT)) {
                if (test_opt(sbi, DISABLE_CHECKPOINT)) {
                        err = f2fs_disable_checkpoint(sbi);
                        if (err)