From b7c2b76c669c3c1427e9f7baf52e7a3cfa73f431 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Wed, 27 Apr 2022 12:56:17 -0700 Subject: [PATCH] Fix O_APPEND for Linux 3.15 and older kernels When using a Linux kernel which predates the iov_iter interface the O_APPEND flag should be applied in zpl_aio_write() via the call to generic_write_checks(). The updated pos variable was incorrectly ignored resulting in the current offset being used. This issue should only realistically impact the RHEL/CentOS 7.x kernels which are based on Linux 3.10. Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #13370 Closes #13377 --- module/os/linux/zfs/zpl_file.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/os/linux/zfs/zpl_file.c b/module/os/linux/zfs/zpl_file.c index 78cf7e7ef10e..2d7864ddb3c2 100644 --- a/module/os/linux/zfs/zpl_file.c +++ b/module/os/linux/zfs/zpl_file.c @@ -417,6 +417,8 @@ zpl_aio_write(struct kiocb *kiocb, const struct iovec *iov, if (ret) return (ret); + kiocb->ki_pos = pos; + zfs_uio_t uio; zfs_uio_iovec_init(&uio, iov, nr_segs, kiocb->ki_pos, UIO_USERSPACE, count, 0);