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: <877ffmhvzt.fsf@openvz.org>
Date:	Mon, 25 Apr 2016 12:35:02 +0300
From:	Dmitry Monakhov <dmonlist@...il.com>
To:	Theodore Ts'o <tytso@....edu>,
	Ext4 Developers List <linux-ext4@...r.kernel.org>
Cc:	Theodore Ts'o <tytso@....edu>
Subject: Re: [PATCH] ext4: refuse O_DIRECT opens for mode where DIO doesn't work

Theodore Ts'o <tytso@....edu> writes:

> Certain ext4 modes (encryption, data=journal, inline data) cause
> Direct I/O to be a no-op.  Instead of making DIO fail silently, make
> the open with the O_DIRECT flag fail with EINVAL.
>
> This will avoid surprises to application programs, and also signal to
> xfstests not to try O_DIRECT tests for file system modes where it
> doesn't work (and could result in test failures).
>
> Signed-off-by: Theodore Ts'o <tytso@....edu>
> ---
>  fs/ext4/file.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index fa2208b..4113676 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -372,7 +372,12 @@ static int ext4_file_open(struct inode * inode, struct file * filp)
>  			return -EACCES;
>  		if (ext4_encryption_info(inode) == NULL)
>  			return -ENOKEY;
> +		if (filp->f_flags & O_DIRECT)
> +			return -EINVAL;
>  	}
> +	if ((ext4_should_journal_data(inode) || ext4_has_inline_data(inode)) &&
> +	    (filp->f_flags & O_DIRECT))
Hmm...
__ext4_new_inode set EXT4_STATE_MAY_INLINE_DATA for each inode if
ext4_has_feature_inline_data(sb) is true.
So this may result in complain from user who want inline data
optimization for small files, but also want O_DIRECT to works.
IMHO it is reasonable to convert inline inodes to regular ones if user
open it for WRITE with O_DIRECT
> +		return -EINVAL;
>  
>  	dir = dget_parent(file_dentry(filp));
>  	if (ext4_encrypted_inode(d_inode(dir)) &&
> -- 
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Download attachment "signature.asc" of type "application/pgp-signature" (473 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ