This commit is in no way a bugfix and I don't see any reason to
backport it to stable kernels.

Thanks,
-Eric

On 5/5/25 5:06 PM, Sasha Levin wrote:
> From: Eric Sandeen <sand...@redhat.com>
> 
> [ Upstream commit 9cca49875997a1a7e92800a828a62bacb0f577b9 ]
> 
> 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 <sand...@redhat.com>
> Reviewed-by: Chao Yu <c...@kernel.org>
> Signed-off-by: Jaegeuk Kim <jaeg...@kernel.org>
> Signed-off-by: Sasha Levin <sas...@kernel.org>
> ---
>  fs/f2fs/super.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index b8a0e925a4011..d3b04a589b525 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -728,10 +728,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)) {
> @@ -1418,6 +1416,12 @@ static int parse_options(struct super_block *sb, char 
> *options, bool is_remount)
>               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;
>  }
>  



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to