All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Monakhov <dmonlist@gmail.com>
To: Theodore Ts'o <tytso@mit.edu>,
	Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH] ext4: refuse O_DIRECT opens for mode where DIO doesn't work
Date: Mon, 25 Apr 2016 12:35:02 +0300	[thread overview]
Message-ID: <877ffmhvzt.fsf@openvz.org> (raw)
In-Reply-To: <1461472078-20104-1-git-send-email-tytso@mit.edu>

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

Theodore Ts'o <tytso@mit.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@mit.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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

  reply	other threads:[~2016-04-25  9:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24  4:27 [PATCH] ext4: refuse O_DIRECT opens for mode where DIO doesn't work Theodore Ts'o
2016-04-25  9:35 ` Dmitry Monakhov [this message]
2016-04-25 23:49   ` Dave Chinner
2016-04-26  0:20     ` Theodore Ts'o
2016-04-26  8:14     ` O_DIRECT as a hint, was: " Christoph Hellwig
2016-04-26 15:07       ` Mike Marshall
     [not found]       ` <20160426081451.GA25616-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2016-04-27  2:16         ` Theodore Ts'o
2016-04-27  2:16           ` Theodore Ts'o
     [not found]           ` <20160427021649.GA30021-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2016-04-27  2:22             ` Eric Sandeen
2016-04-27  2:22               ` Eric Sandeen
2016-04-27  2:25           ` Dave Chinner
2016-04-27  2:27         ` Dave Chinner
2016-04-27  2:27           ` Dave Chinner
2016-04-27  3:25           ` Theodore Ts'o
     [not found]             ` <20160427032526.GC30021-AKGzg7BKzIDYtjvyW6yDsg@public.gmane.org>
2016-04-27  3:37               ` Dave Chinner
2016-04-27  3:37                 ` Dave Chinner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877ffmhvzt.fsf@openvz.org \
    --to=dmonlist@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.