From 5e6b7541e5c74f5714ae863a52b959cd6da5494a Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Mon, 25 Apr 2022 16:53:11 -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. Signed-off-by: Brian Behlendorf --- 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 3307c9c3a203..6351e7b56c29 100644 --- a/module/os/linux/zfs/zpl_file.c +++ b/module/os/linux/zfs/zpl_file.c @@ -413,6 +413,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);