lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220831120652.rovamxbtt4ibutar@quack3>
Date:   Wed, 31 Aug 2022 14:06:52 +0200
From:   Jan Kara <jack@...e.cz>
To:     Jason Yan <yanaijie@...wei.com>
Cc:     tytso@....edu, adilger.kernel@...ger.ca, jack@...e.cz,
        ritesh.list@...il.com, lczerner@...hat.com,
        linux-ext4@...r.kernel.org
Subject: Re: [PATCH 13/13] ext4: factor out ext4_journal_data_check()

On Tue 30-08-22 20:04:11, Jason Yan wrote:
> Factor out ext4_journal_data_check(). No functional change.
> 
> Signed-off-by: Jason Yan <yanaijie@...wei.com>
> ---
>  fs/ext4/super.c | 60 ++++++++++++++++++++++++++++---------------------
>  1 file changed, 35 insertions(+), 25 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 95e70f0316db..c070d4f5ecc4 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4910,6 +4910,39 @@ static int ext4_load_and_init_journal(struct super_block *sb,
>  	return err;
>  }
>  
> +static int ext4_journal_data_check(struct super_block *sb)

Perhaps name this ext4_journal_data_mode_check()? Otherwise feel free to
add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> +{
> +	if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
> +		printk_once(KERN_WARNING "EXT4-fs: Warning: mounting with "
> +			    "data=journal disables delayed allocation, "
> +			    "dioread_nolock, O_DIRECT and fast_commit support!\n");
> +		/* can't mount with both data=journal and dioread_nolock. */
> +		clear_opt(sb, DIOREAD_NOLOCK);
> +		clear_opt2(sb, JOURNAL_FAST_COMMIT);
> +		if (test_opt2(sb, EXPLICIT_DELALLOC)) {
> +			ext4_msg(sb, KERN_ERR, "can't mount with "
> +				 "both data=journal and delalloc");
> +			return -EINVAL;
> +		}
> +		if (test_opt(sb, DAX_ALWAYS)) {
> +			ext4_msg(sb, KERN_ERR, "can't mount with "
> +				 "both data=journal and dax");
> +			return -EINVAL;
> +		}
> +		if (ext4_has_feature_encrypt(sb)) {
> +			ext4_msg(sb, KERN_WARNING,
> +				 "encrypted files will use data=ordered "
> +				 "instead of data journaling mode");
> +		}
> +		if (test_opt(sb, DELALLOC))
> +			clear_opt(sb, DELALLOC);
> +	} else {
> +		sb->s_iflags |= SB_I_CGROUPWB;
> +	}
> +
> +	return 0;
> +}
> +
>  static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
>  {
>  	struct buffer_head *bh;
> @@ -5033,31 +5066,8 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
>  	if (ext4_encoding_init(sb, es))
>  		goto failed_mount;
>  
> -	if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
> -		printk_once(KERN_WARNING "EXT4-fs: Warning: mounting with data=journal disables delayed allocation, dioread_nolock, O_DIRECT and fast_commit support!\n");
> -		/* can't mount with both data=journal and dioread_nolock. */
> -		clear_opt(sb, DIOREAD_NOLOCK);
> -		clear_opt2(sb, JOURNAL_FAST_COMMIT);
> -		if (test_opt2(sb, EXPLICIT_DELALLOC)) {
> -			ext4_msg(sb, KERN_ERR, "can't mount with "
> -				 "both data=journal and delalloc");
> -			goto failed_mount;
> -		}
> -		if (test_opt(sb, DAX_ALWAYS)) {
> -			ext4_msg(sb, KERN_ERR, "can't mount with "
> -				 "both data=journal and dax");
> -			goto failed_mount;
> -		}
> -		if (ext4_has_feature_encrypt(sb)) {
> -			ext4_msg(sb, KERN_WARNING,
> -				 "encrypted files will use data=ordered "
> -				 "instead of data journaling mode");
> -		}
> -		if (test_opt(sb, DELALLOC))
> -			clear_opt(sb, DELALLOC);
> -	} else {
> -		sb->s_iflags |= SB_I_CGROUPWB;
> -	}
> +	if (ext4_journal_data_check(sb))
> +		goto failed_mount;
>  
>  	sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
>  		(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
> -- 
> 2.31.1
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ