VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Chao Yu <yuchao0@huawei.com> 2021-03-17 17:56:03 +0800 committer: Jaegeuk Kim <jaegeuk@kernel.org> 2021-03-25 18:20:51 -0700 commit: 3f7070b05052f997d571a51e750583b9dea726f8 parent: ac2d750b2043cbe10d42ac974e07b9876cddfff8
Commit Summary:
f2fs: don't start checkpoint thread in readonly mountpoint
Diffstat:
1 file changed, 5 insertions, 5 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index e03b2f0f69d0..721dc64609b4 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -2069,8 +2069,10 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 		}
 	}
 
-	if (!test_opt(sbi, DISABLE_CHECKPOINT) &&
-			test_opt(sbi, MERGE_CHECKPOINT)) {
+	if ((*flags & SB_RDONLY) || test_opt(sbi, DISABLE_CHECKPOINT) ||
+			!test_opt(sbi, MERGE_CHECKPOINT)) {
+		f2fs_stop_ckpt_thread(sbi);
+	} else {
 		err = f2fs_start_ckpt_thread(sbi);
 		if (err) {
 			f2fs_err(sbi,
@@ -2078,8 +2080,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
 			    err);
 			goto restore_gc;
 		}
-	} else {
-		f2fs_stop_ckpt_thread(sbi);
 	}
 
 	/*
@@ -3835,7 +3835,7 @@ try_onemore:
 
 	/* setup checkpoint request control and start checkpoint issue thread */
 	f2fs_init_ckpt_req_control(sbi);
-	if (!test_opt(sbi, DISABLE_CHECKPOINT) &&
+	if (!f2fs_readonly(sb) && !test_opt(sbi, DISABLE_CHECKPOINT) &&
 			test_opt(sbi, MERGE_CHECKPOINT)) {
 		err = f2fs_start_ckpt_thread(sbi);
 		if (err) {