hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I9VTE3 CVE: NA
--------------------------------
If the file support atomic write, while the user initiates a direct write, convert the write to atomic write, it makes database like Mysql could use atomic write without any other more modify. This also causes some direct writes(such as offset misalignment and invalid length) to the files which with atomic write enabled to return fails.
Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/xfs_file.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 10543ac116f2..b197e81007db 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -811,6 +811,8 @@ xfs_file_write_iter( return xfs_file_dax_write(iocb, from);
if (iocb->ki_flags & IOCB_DIRECT) { + if (xfs_inode_atomicwrites(ip)) + iocb->ki_flags |= IOCB_ATOMIC; /* * Allow a directio write to fall back to a buffered * write *only* in the case that we're doing a reflink