vfs: fix bad hashing of dentries
[firefly-linux-kernel-4.4.55.git] / fs / nfs / nfs4client.c
index 947b0c908aa908c643140dd7087b0927753c6d49..02773aab43c52a828ec890f5f56e4279f906d5b2 100644 (file)
@@ -203,7 +203,7 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
        __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags);
        error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_GSS_KRB5I);
        if (error == -EINVAL)
-               error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_NULL);
+               error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX);
        if (error < 0)
                goto error;
 
@@ -240,13 +240,11 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
        error = nfs4_discover_server_trunking(clp, &old);
        if (error < 0)
                goto error;
-       nfs_put_client(clp);
-       if (clp != old) {
-               clp->cl_preserve_clid = true;
-               clp = old;
-       }
 
-       return clp;
+       if (clp != old)
+               clp->cl_preserve_clid = true;
+       nfs_put_client(clp);
+       return old;
 
 error:
        nfs_mark_client_ready(clp, error);
@@ -324,9 +322,10 @@ int nfs40_walk_client_list(struct nfs_client *new,
                        prev = pos;
 
                        status = nfs_wait_client_init_complete(pos);
-                       spin_lock(&nn->nfs_client_lock);
                        if (status < 0)
-                               continue;
+                               goto out;
+                       status = -NFS4ERR_STALE_CLIENTID;
+                       spin_lock(&nn->nfs_client_lock);
                }
                if (pos->cl_cons_state != NFS_CS_READY)
                        continue;
@@ -464,7 +463,8 @@ int nfs41_walk_client_list(struct nfs_client *new,
                        }
                        spin_lock(&nn->nfs_client_lock);
                        if (status < 0)
-                               continue;
+                               break;
+                       status = -NFS4ERR_STALE_CLIENTID;
                }
                if (pos->cl_cons_state != NFS_CS_READY)
                        continue;