android_kernel_xiaomi_sm7250/fs/minix
Qinghua Jin 1e395306ba 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>
2022-04-15 14:15:03 +02:00
..
bitmap.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +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 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
inode.c minix: fix bug when opening a file with O_DIRECT 2022-04-15 14:15:03 +02:00
itree_common.c fs/minix: check return value of sb_getblk() 2020-08-19 08:15:05 +02:00
itree_v1.c fs/minix: remove expected error message in block_to_path() 2020-08-21 11:05:38 +02:00
itree_v2.c fs/minix: remove expected error message in block_to_path() 2020-08-21 11:05:38 +02:00
Kconfig treewide: simplify Kconfig dependencies for removed archs 2018-03-26 15:55:57 +02:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
minix.h fs/minix: set s_maxbytes correctly 2020-08-21 11:05:38 +02:00
namei.c minix_lookup: use d_splice_alias() 2018-05-22 14:27:52 -04:00