I noticed while testing against a NetApp filer that the Linux NFSv4 client currently translates NFS4ERR_SHARE_DENIED errors to EIO; it would be nice if this was translated to something more sensible like EACCES. (This was on an Ubuntu 11.10 client, but AFAICT NFS4ERR_SHARE_DENIED is not referenced in the mainline kernel tree either.) # uname -a Linux kjamieson 3.0.0-19-generic #33-Ubuntu SMP Thu Apr 19 19:05:14 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux # strace cat /mnt/file1 open("/mnt/file1", O_RDONLY) = -1 EIO (Input/output error) Network File System [Program Version: 4] [V4 Procedure: COMPOUND (1)] Status: NFS4ERR_SHARE_DENIED (10015) Tag: <EMPTY> length: 0 contents: <EMPTY> Operations (count: 3) Opcode: PUTFH (22) Status: NFS4_OK (0) Opcode: SAVEFH (32) Status: NFS4_OK (0) Opcode: OPEN (18) Status: NFS4ERR_SHARE_DENIED (10015) As a point of comparison, Solaris appears to map NFS4ERR_SHARE_DENIED to EACCES: # uname -a SunOS nas-sol10-vm1 5.10 Generic_139556-08 i86pc i386 i86pc # truss cat /mnt/file1 open64("/mnt/file1", O_RDONLY) Err#13 EACCES
Created attachment 73448 [details] NFSv4: Map NFS4ERR_SHARE_DENIED into an EACCES error instead of EIO
Does the above attachment fix the problem?
Thanks, the patch looks good: $ cat /mount/nfs4/locked.file cat: /mount/nfs4/locked.file: Permission denied 9 0.115393 10.53.16.206 -> 10.96.65.126 NFS 130 V4 Reply (Call In 8) OPEN Status: NFS4ERR_SHARE_DENIED
Pushed to Linus, so I'm marking this as resolved.
A patch referencing this bug report has been merged in Linux v3.5-rc1: commit fb13bfa7e1bcfdcfdece47c24b62f1a1cad957e9 Author: Trond Myklebust <Trond.Myklebust@netapp.com> Date: Mon May 28 11:36:28 2012 -0400 NFSv4: Map NFS4ERR_SHARE_DENIED into an EACCES error instead of EIO