[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230803141857.ec5sjy6deg7stnax@quack3>
Date: Thu, 3 Aug 2023 16:18:57 +0200
From: Jan Kara <jack@...e.cz>
To: Zhang Yi <yi.zhang@...weicloud.com>
Cc: linux-ext4@...r.kernel.org, tytso@....edu,
adilger.kernel@...ger.ca, jack@...e.cz, yi.zhang@...wei.com,
chengzhihao1@...wei.com, yukuai3@...wei.com
Subject: Re: [PATCH 04/12] jbd2: checking valid features early in
journal_get_superblock()
On Tue 04-07-23 21:42:25, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@...wei.com>
>
> journal_get_superblock() is used to check validity of the jounal
> supberblock, so move the features checks from jbd2_journal_load() to
> journal_get_superblock().
>
> Signed-off-by: Zhang Yi <yi.zhang@...wei.com>
Looks good. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.cz>
Honza
> ---
> fs/jbd2/journal.c | 30 +++++++++++++++---------------
> 1 file changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index c7cdb434966f..d84f26b08315 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -1398,6 +1398,21 @@ static int journal_get_superblock(journal_t *journal)
> goto out;
> }
>
> + /*
> + * If this is a V2 superblock, then we have to check the
> + * features flags on it.
> + */
> + if (!jbd2_format_support_feature(journal))
> + return 0;
> +
> + if ((sb->s_feature_ro_compat &
> + ~cpu_to_be32(JBD2_KNOWN_ROCOMPAT_FEATURES)) ||
> + (sb->s_feature_incompat &
> + ~cpu_to_be32(JBD2_KNOWN_INCOMPAT_FEATURES))) {
> + printk(KERN_WARNING "JBD2: Unrecognised features on journal\n");
> + goto out;
> + }
> +
> if (jbd2_has_feature_csum2(journal) &&
> jbd2_has_feature_csum3(journal)) {
> /* Can't have checksum v2 and v3 at the same time! */
> @@ -2059,21 +2074,6 @@ int jbd2_journal_load(journal_t *journal)
> int err;
> journal_superblock_t *sb = journal->j_superblock;
>
> - /*
> - * If this is a V2 superblock, then we have to check the
> - * features flags on it.
> - */
> - if (jbd2_format_support_feature(journal)) {
> - if ((sb->s_feature_ro_compat &
> - ~cpu_to_be32(JBD2_KNOWN_ROCOMPAT_FEATURES)) ||
> - (sb->s_feature_incompat &
> - ~cpu_to_be32(JBD2_KNOWN_INCOMPAT_FEATURES))) {
> - printk(KERN_WARNING
> - "JBD2: Unrecognised features on journal\n");
> - return -EINVAL;
> - }
> - }
> -
> /*
> * Create a slab for this blocksize
> */
> --
> 2.39.2
>
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists