NFSv4: Fix return values for nfs4_file_open()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 9 Aug 2019 19:03:11 +0000 (15:03 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 19 Aug 2019 12:56:04 +0000 (08:56 -0400)
Currently, we are translating RPC level errors such as timeouts,
as well as interrupts etc into EOPENSTALE, which forces a single
replay of the open attempt. What we actually want to do is
force the replay only in the cases where the returned error
indicates that the file may have changed on the server.

So the fix is to spell out the exact set of errors where we want
to return EOPENSTALE.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4file.c

index 96db471ca2e5c5413edf5ffe120097cb88d079ee..339663d04bf83b28f3f4426eba8419d4e750146f 100644 (file)
@@ -73,13 +73,13 @@ nfs4_file_open(struct inode *inode, struct file *filp)
        if (IS_ERR(inode)) {
                err = PTR_ERR(inode);
                switch (err) {
-               case -EPERM:
-               case -EACCES:
-               case -EDQUOT:
-               case -ENOSPC:
-               case -EROFS:
-                       goto out_put_ctx;
                default:
+                       goto out_put_ctx;
+               case -ENOENT:
+               case -ESTALE:
+               case -EISDIR:
+               case -ENOTDIR:
+               case -ELOOP:
                        goto out_drop;
                }
        }