From d8abbead904db6ccda11b7deb855525eda487bf1 Mon Sep 17 00:00:00 2001 From: Chao Yu Date: Thu, 18 Nov 2021 15:35:20 +0900 Subject: [PATCH] f2fs: fix wrong checkpoint_changed value in f2fs_remount() 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 Signed-off-by: Jaegeuk Kim [dwoo08.lee: backport from mainline commit 277afbde6ca2] Signed-off-by: Dongwoo Lee Change-Id: Icd4dfff441bf84f605d8d09de7be89da88548654 --- fs/f2fs/super.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index dacb3bc..071d602 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -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) -- 2.7.4