aboutsummaryrefslogtreecommitdiff
path: root/fsck/main.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-04-23 10:42:20 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-04-28 06:25:58 -0700
commit264d7da4d68bc6a399a24e690b0f118e59a63aec (patch)
tree68380489dfd63ebcaf0fd75b0e87394f7a9897bf /fsck/main.c
parent98e6f003d46365001328e9bf1ab14af99f5b1b1a (diff)
downloadf2fs-tools-264d7da4d68bc6a399a24e690b0f118e59a63aec.tar.gz
fsck.f2fs: fix to repair ro mounted device w/ -f
As Hagbard Celine reported: " Referring to the output from the fsck running against a "ro" filesystem, especially this line: Info: Check FS only due to RO As far as i can tell this says that opposed to other filesystems running fsck against a "ro" mounted f2fs partition will never fix any errors. So I tried running fsck against the same partition mounted "rw": - mount -o remount,rw /mnt/f2fstest/ - fsck.f2fs -f /dev/nvme0n1p7 Info: Force to fix corruption Info: Mounted device! Error: Not available on mounted device! I might be misunderstanding something, but all this tells me that unless one make a custom initramfs that runs fsck before root is mounted (something no distributions has, as far as I know), fsck will never fix an f2fs formatted root partition during boot. If this is by design and not a bug/unintended behavior, it should be documented somewhere least more people will experience system crashes like mine. All tests above done with kernel 5.0.5 and f2fs-tools 1.12.0 with "fsck.f2fs: allow to fsck readonly image w/ -f option"-patch by Chao Yu. " We try to make our fsck behavior keeping line with e2fsprogs, but w/ -f option, we can just check a RO mounted device rather repair it, so let's fix this. Reported-and-Tested-by: Hagbard Celine <hagbardcelin@gmail.com> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fsck/main.c')
-rw-r--r--fsck/main.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fsck/main.c b/fsck/main.c
index d3f0c0d..03076d9 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -757,9 +757,13 @@ int main(int argc, char **argv)
}
/* allow ro-mounted partition */
- MSG(0, "Info: Check FS only due to RO\n");
- c.fix_on = 0;
- c.auto_fix = 0;
+ if (c.force) {
+ MSG(0, "Info: Force to check/repair FS on RO mounted device\n");
+ } else {
+ MSG(0, "Info: Check FS only on RO mounted device\n");
+ c.fix_on = 0;
+ c.auto_fix = 0;
+ }
}
/* Get device */