]> git.hungrycats.org Git - linux/commitdiff
NFSv4: Fix a bug when the server returns NFS4ERR_RESOURCE
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 23 Oct 2009 18:46:42 +0000 (14:46 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Nov 2009 00:23:01 +0000 (16:23 -0800)
commit 52567b03ca38b6e556ced450d64dba8d66e23b0e upstream.

RFC 3530 states that when we recieve the error NFS4ERR_RESOURCE, we are not
supposed to bump the sequence number on OPEN, LOCK, LOCKU, CLOSE, etc
operations. The problem is that we map that error into EREMOTEIO in the XDR
layer, and so the NFSv4 middle-layer routines like seqid_mutating_err(),
and nfs_increment_seqid() don't recognise it.

The fix is to defer the mapping until after the middle layers have
processed the error.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfs/nfs4proc.c
fs/nfs/nfs4xdr.c

index 6917311f201c32d679772337e440ba21e807a04b..6c1534cdef1fecef3b51ffc38eef4fd763f7a8eb 100644 (file)
@@ -71,12 +71,17 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
 /* Prevent leaks of NFSv4 errors into userland */
 static int nfs4_map_errors(int err)
 {
-       if (err < -1000) {
+       if (err >= -1000)
+               return err;
+       switch (err) {
+       case -NFS4ERR_RESOURCE:
+               return -EREMOTEIO;
+       default:
                dprintk("%s could not handle NFSv4 error %d\n",
                                __func__, -err);
-               return -EIO;
+               break;
        }
-       return err;
+       return -EIO;
 }
 
 /*
index 617273e7d47f56df133c44bc93449b369f97b70f..f4c9e1a0d9ce12a6b0c0b59af0c00f02e8fc519b 100644 (file)
@@ -5406,7 +5406,6 @@ static struct {
        { NFS4ERR_SERVERFAULT,  -ESERVERFAULT   },
        { NFS4ERR_BADTYPE,      -EBADTYPE       },
        { NFS4ERR_LOCKED,       -EAGAIN         },
-       { NFS4ERR_RESOURCE,     -EREMOTEIO      },
        { NFS4ERR_SYMLINK,      -ELOOP          },
        { NFS4ERR_OP_ILLEGAL,   -EOPNOTSUPP     },
        { NFS4ERR_DEADLOCK,     -EDEADLK        },