Skip to content

Commit

Permalink
Fix O_APPEND for Linux 3.15 and older kernels
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#13370 
Closes openzfs#13377
  • Loading branch information
behlendorf authored and andrewc12 committed Sep 23, 2022
1 parent 1c0d636 commit 2dbed43
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/os/linux/zfs/zpl_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 2dbed43

Please sign in to comment.