diff options
author | 2025-03-03 11:12:17 -0600 | |
---|---|---|
committer | 2025-03-13 18:16:06 +0000 | |
commit | 9cca49875997a1a7e92800a828a62bacb0f577b9 (patch) | |
tree | 9fa425552055b3658cef0c1f714e64dcca060ec2 | |
parent | f2fs: Pass sbi rather than sb to f2fs_set_test_dummy_encryption (diff) | |
download | wireguard-linux-9cca49875997a1a7e92800a828a62bacb0f577b9.tar.xz wireguard-linux-9cca49875997a1a7e92800a828a62bacb0f577b9.zip |
f2fs: defer readonly check vs norecovery
Defer the readonly-vs-norecovery check until after option parsing is done
so that option parsing does not require an active superblock for the test.
Add a helpful message, while we're at it.
(I think could be moved back into parsing after we switch to the new mount
API if desired, as the fs context will have RO state available.)
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/super.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 4ffa95dd41df..3589d1ff97a3 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -730,10 +730,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) set_opt(sbi, DISABLE_ROLL_FORWARD); break; case Opt_norecovery: - /* this option mounts f2fs with ro */ + /* requires ro mount, checked in f2fs_default_check */ set_opt(sbi, NORECOVERY); - if (!f2fs_readonly(sb)) - return -EINVAL; break; case Opt_discard: if (!f2fs_hw_support_discard(sbi)) { @@ -1417,6 +1415,12 @@ static int f2fs_default_check(struct f2fs_sb_info *sbi) f2fs_err(sbi, "Allow to mount readonly mode only"); return -EROFS; } + + if (test_opt(sbi, NORECOVERY) && !f2fs_readonly(sbi->sb)) { + f2fs_err(sbi, "norecovery requires readonly mount"); + return -EINVAL; + } + return 0; } |