[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220106110028.jxicjy245ypdqejb@quack3.lan>
Date: Thu, 6 Jan 2022 12:00:28 +0100
From: Jan Kara <jack@...e.cz>
To: Qinghua Jin <qhjin.dev@...il.com>
Cc: christian.brauner@...ntu.com, qhjin_dev@....com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jan Kara <jack@...e.cz>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] minix: fix bug when opening a file with O_DIRECT will
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@...il.com>
The patch looks good. Thanks. Feel free to add:
Reviewed-by: Jan Kara <jack@...e.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@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists