]> git.proxmox.com Git - mirror_zfs.git/commit - module/zfs/zpl_file.c
Fix O_APPEND open(2) flag
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 20 Feb 2015 18:28:25 +0000 (10:28 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 24 Feb 2015 19:21:54 +0000 (11:21 -0800)
commit1efdc45ea805e61de2c54736cd1b2a4a5f48a913
tree864346e155a41ce191030482021f8545db1a877c
parent1d966336f5095c7e0345360c3862577642670d2d
Fix O_APPEND open(2) flag

As described in flags section of open(2):

  O_APPEND:
    The  file  is  opened in append mode.  Before each write(2), the
    file offset is positioned at the end of the  file,  as  if  with
    lseek(2).   O_APPEND may lead to corrupted files on NFS filesys-
    tems if more than one process appends data to a  file  at  once.
    This is because NFS does not support appending to a file, so the
    client kernel has to simulate it, which can't be done without  a
    race condition.

This issue was originally overlooked because normally the generic
VFS code handles this for a filesystem.  However, because ZFS explictly
registers a zpl_write() function it's responsible for the seek.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3124
module/zfs/zpl_file.c