summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJohn Garry <john.g.garry@oracle.com>2024-10-19 15:51:07 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-05 16:01:11 +0300
commitcfe3e04e9a5704aac92aaa2b45706850d96af0b9 (patch)
tree97ba109623ed22b5790a83c9aa1a0f1a08616503 /include
parent78de864e8af3649b03f905e206e6f06f3aa4c006 (diff)
downloadlinux-cfe3e04e9a5704aac92aaa2b45706850d96af0b9.tar.xz
fs/block: Check for IOCB_DIRECT in generic_atomic_write_valid()
[ Upstream commit c3be7ebbbce5201e151f17e28a6c807602f369c9 ] Currently FMODE_CAN_ATOMIC_WRITE is set if the bdev can atomic write and the file is open for direct IO. This does not work if the file is not opened for direct IO, yet fcntl(O_DIRECT) is used on the fd later. Change to check for direct IO on a per-IO basis in generic_atomic_write_valid(). Since we want to report -EOPNOTSUPP for non-direct IO for an atomic write, change to return an error code. Relocate the block fops atomic write checks to the common write path, as to catch non-direct IO. Fixes: c34fc6f26ab8 ("fs: Initial atomic write support") Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: John Garry <john.g.garry@oracle.com> Link: https://lore.kernel.org/r/20241019125113.369994-3-john.g.garry@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index faf7596ace97..4b5cad44a126 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -3726,6 +3726,6 @@ static inline bool vfs_empty_path(int dfd, const char __user *path)
return !c;
}
-bool generic_atomic_write_valid(struct kiocb *iocb, struct iov_iter *iter);
+int generic_atomic_write_valid(struct kiocb *iocb, struct iov_iter *iter);
#endif /* _LINUX_FS_H */