Bug 43286 - NFS4ERR_SHARE_DENIED errors are translated to EIO
Summary: NFS4ERR_SHARE_DENIED errors are translated to EIO
Status: CLOSED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: NFS (show other bugs)
Hardware: All Linux
: P1 low
Assignee: Trond Myklebust
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-23 22:58 UTC by Kevin Jamieson
Modified: 2012-07-01 09:37 UTC (History)
2 users (show)

See Also:
Kernel Version: 3.0.0-19 x86_64
Subsystem:
Regression: No
Bisected commit-id:


Attachments
NFSv4: Map NFS4ERR_SHARE_DENIED into an EACCES error instead of EIO (1.07 KB, patch)
2012-05-28 15:42 UTC, Trond Myklebust
Details | Diff

Description Kevin Jamieson 2012-05-23 22:58:45 UTC
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
Comment 1 Trond Myklebust 2012-05-28 15:42:38 UTC
Created attachment 73448 [details]
NFSv4: Map NFS4ERR_SHARE_DENIED into an EACCES error instead of EIO
Comment 2 Trond Myklebust 2012-05-28 15:43:20 UTC
Does the above attachment fix the problem?
Comment 3 Kevin Jamieson 2012-05-30 17:51:59 UTC
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
Comment 4 Trond Myklebust 2012-05-30 17:53:57 UTC
Pushed to Linus, so I'm marking this as resolved.
Comment 5 Florian Mickler 2012-07-01 09:37:29 UTC
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

Note You need to log in before you can comment on or make changes to this bug.