Skip to content
  • Rick Macklem's avatar
    Fix an interoperability issue w.r.t. the Linux client and the NFSv4 server. · b0b7d978
    Rick Macklem authored
    Luoqi Chen reported a problem on freebsd-fs@ where a Linux NFSv4 client
    was able to open and write to a file when the file's permissions were
    not set to allow the owner write access.
    
    Since NFS servers check file permissions on every write RPC, it is standard
    practice to allow the owner of the file to do writes, regardless of
    file permissions. This provides POSIX like behaviour, since POSIX only
    checks permissions upon open(2).
    The traditional way NFS clients handle this is to check access via the
    Access operation/RPC and use that to determine if an open(2) on the
    client is allowed.
    
    It appears that, for NFSv4, the Linux client expects the NFSv4 Open (not a
    POSIX open) operation to fail with NFSERR_ACCES if the file is not being
    created and file permissions do not allow owner access, unlike NFSv3.
    Since both the Linux and OpenSolaris NFSv4 servers seem to exhibit this
    behaviour, this patch changes the FreeBSD NFSv4 server to do the same.
    A sysctl called vfs.nfsd.v4openaccess can be set to 0 to return the
    NFSv4 server to its previous behaviour.
    
    Since both the Linux and FreeBSD NFSv4 clients seem to exhibit correct
    behaviour with the access check for file owner in Open enabled, it is enabled
    by default.
    
    Reported by:	luoqi.chen@gmail.com
    MFC after:	2 weeks
    b0b7d978