mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Qinghua Jin <qhjin.dev@gmail.com>
Cc: christian.brauner@ubuntu.com, qhjin_dev@163.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jan Kara <jack@suse.cz>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] minix: fix bug when opening a file with O_DIRECT will
Date: Thu, 6 Jan 2022 12:00:28 +0100	[thread overview]
Message-ID: <20220106110028.jxicjy245ypdqejb@quack3.lan> (raw)
In-Reply-To: <20220106033042.347301-1-qhjin.dev@gmail.com>

On Thu 06-01-22 11:30:41, Qinghua Jin wrote:
> Testcase:
> 1. create a minix file system and mount it
> 2. open a file on the file system with O_RDWR|O_CREAT|O_TRUNC|O_DIRECT
> 3. open fails with -EINVAL but leaves an empty file behind. All other
> open() failures don't leave the failed open files behind.
> 
> It is hard to check the direct_IO op before creating the inode. Just as
> ext4 and btrfs do, this patch will resolve the issue by allowing to 
> create the file with O_DIRECT but returning error when writing the file.
> 
> Signed-off-by: Qinghua Jin <qhjin.dev@gmail.com>

The patch looks good. Thanks. Feel free to add:

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

Just out of curiosity: Do you happen to really use minix filesystem or was
this just a fallout from some fuzz testing or something like that?

								Honza
> ---
>  fs/minix/inode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/minix/inode.c b/fs/minix/inode.c
> index a71f1cf894b9..d4bd94234ef7 100644
> --- a/fs/minix/inode.c
> +++ b/fs/minix/inode.c
> @@ -447,7 +447,8 @@ static const struct address_space_operations minix_aops = {
>  	.writepage = minix_writepage,
>  	.write_begin = minix_write_begin,
>  	.write_end = generic_write_end,
> -	.bmap = minix_bmap
> +	.bmap = minix_bmap,
> +	.direct_IO = noop_direct_IO
>  };
>  
>  static const struct inode_operations minix_symlink_inode_operations = {
> -- 
> 2.30.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

  reply	other threads:[~2022-01-06 15:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-06  3:30 Qinghua Jin
2022-01-06 11:00 ` Jan Kara [this message]
     [not found]   ` <CACL7WEN+eBW2MFGCti-NAzxAZAKXkjJ2F+6=eGqX0UdcAzw8Eg@mail.gmail.com>
2022-01-07 11:32     ` Christian Brauner
2022-01-07 13:36       ` [PATCH v2] minix: fix bug when opening a file with O_DIRECT Qinghua Jin

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=20220106110028.jxicjy245ypdqejb@quack3.lan \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=christian.brauner@ubuntu.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qhjin.dev@gmail.com \
    --cc=qhjin_dev@163.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®