summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorQinghua Jin <qhjin.dev@gmail.com>2022-03-23 16:06:23 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 14:15:03 +0200
commit1e395306ba950f70c93d7e8980cb99dc4081b47d (patch)
tree9b238f356d961395ad7f2303dca96e938854bffa /fs
parentc616808669f9f6e8f9f28f2f38ddb5f322160b94 (diff)
downloadlinux-stable-1e395306ba950f70c93d7e8980cb99dc4081b47d.tar.gz
linux-stable-1e395306ba950f70c93d7e8980cb99dc4081b47d.tar.bz2
linux-stable-1e395306ba950f70c93d7e8980cb99dc4081b47d.zip
minix: fix bug when opening a file with O_DIRECT
[ Upstream commit 9ce3c0d26c42d279b6c378a03cd6a61d828f19ca ] 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. Link: https://lkml.kernel.org/r/20220107133626.413379-1-qhjin.dev@gmail.com Signed-off-by: Qinghua Jin <qhjin.dev@gmail.com> Reported-by: Colin Ian King <colin.king@intel.com> Reviewed-by: Jan Kara <jack@suse.cz> Acked-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/minix/inode.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 03fe8bac36cf..3ce91ad1ee1b 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -450,7 +450,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 = {