WSL2-Linux-Kernel/fs/minix
Qinghua Jin 31e027259c minix: fix bug when opening a file with O_DIRECT
[ Upstream commit 9ce3c0d26c ]

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>
2022-04-13 20:59:10 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
bitmap.c inode: make init and permission helpers idmapped mount aware 2021-01-24 14:27:16 +01:00
dir.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
file.c fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
inode.c minix: fix bug when opening a file with O_DIRECT 2022-04-13 20:59:10 +02:00
itree_common.c fs/minix: check return value of sb_getblk() 2020-08-12 10:58:00 -07:00
itree_v1.c fs/minix: remove expected error message in block_to_path() 2020-08-12 10:58:00 -07:00
itree_v2.c fs/minix: remove expected error message in block_to_path() 2020-08-12 10:58:00 -07:00
minix.h fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00
namei.c fs: make helpers idmap mount aware 2021-01-24 14:27:20 +01:00