On 10/14, Theodore Y. Ts'o wrote:
> Control: tag 942121 +upstream
> 
> Hi Chao, Jaeguk,
> 
> Could you take a look at this complaint and let me know if I should
> close the bug as Working As Intended or not?

We can bypass kernel check by adding an option "--no-kernel-check".
Like this?

>From 0fd26684d7e6d279a6a5553c7b82856cb6068ec3 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaeg...@kernel.org>
Date: Mon, 14 Oct 2019 10:10:31 -0700
Subject: [PATCH] fsck.f2fs: add --no-kernel-check to bypass kernel version
 diff

Given this option, fsck.f2fs does not run fsck forcefully, even if kernel
is updated.

Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org>
---
 fsck/main.c       | 6 ++++++
 fsck/mount.c      | 3 ++-
 include/f2fs_fs.h | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/fsck/main.c b/fsck/main.c
index 8c62a14..a402ffb 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -66,6 +66,7 @@ void fsck_usage()
        MSG(0, "  -y fix all the time\n");
        MSG(0, "  -V print the version number and exit\n");
        MSG(0, "  --dry-run do not really fix corruptions\n");
+       MSG(0, "  --no-kernel-check skips detecting kernel change\n");
        exit(1);
 }
 
@@ -192,6 +193,7 @@ void f2fs_parse_options(int argc, char *argv[])
                char *token;
                struct option long_opt[] = {
                        {"dry-run", no_argument, 0, 1},
+                       {"no-kernel-check", no_argument, 0, 2},
                        {0, 0, 0, 0}
                };
 
@@ -203,6 +205,10 @@ void f2fs_parse_options(int argc, char *argv[])
                                c.dry_run = 1;
                                MSG(0, "Info: Dry run\n");
                                break;
+                       case 2:
+                               c.no_kernel_check = 1;
+                               MSG(0, "Info: No Kernel Check\n");
+                               break;
                        case 'a':
                                c.auto_fix = 1;
                                MSG(0, "Info: Fix the reported corruption.\n");
diff --git a/fsck/mount.c b/fsck/mount.c
index 2d01c2f..98227e7 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -883,7 +883,8 @@ int validate_super_block(struct f2fs_sb_info *sbi, enum 
SB_ADDR sb_addr)
                MSG(0, "Info: MKFS version\n  \"%s\"\n", c.init_version);
                MSG(0, "Info: FSCK version\n  from \"%s\"\n    to \"%s\"\n",
                                        c.sb_version, c.version);
-               if (memcmp(c.sb_version, c.version, VERSION_LEN)) {
+               if (!c.no_kernel_check &&
+                               memcmp(c.sb_version, c.version, VERSION_LEN)) {
                        memcpy(sbi->raw_super->version,
                                                c.version, VERSION_LEN);
                        update_superblock(sbi->raw_super, SB_MASK(sb_addr));
diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
index a722be4..eb178ea 100644
--- a/include/f2fs_fs.h
+++ b/include/f2fs_fs.h
@@ -372,6 +372,7 @@ struct f2fs_configuration {
        int func;
        void *private;
        int dry_run;
+       int no_kernel_check;
        int fix_on;
        int force;
        int defset;
-- 
2.19.0.605.g01d371f741-goog

Reply via email to