aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4client.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4client.c')
-rw-r--r--fs/nfs/nfs4client.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index b4a160a405ce..0e46d3d1b6cc 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -10,6 +10,7 @@
10#include <linux/sunrpc/auth.h> 10#include <linux/sunrpc/auth.h>
11#include <linux/sunrpc/xprt.h> 11#include <linux/sunrpc/xprt.h>
12#include <linux/sunrpc/bc_xprt.h> 12#include <linux/sunrpc/bc_xprt.h>
13#include <linux/sunrpc/rpc_pipe_fs.h>
13#include "internal.h" 14#include "internal.h"
14#include "callback.h" 15#include "callback.h"
15#include "delegation.h" 16#include "delegation.h"
@@ -169,7 +170,7 @@ void nfs41_shutdown_client(struct nfs_client *clp)
169void nfs40_shutdown_client(struct nfs_client *clp) 170void nfs40_shutdown_client(struct nfs_client *clp)
170{ 171{
171 if (clp->cl_slot_tbl) { 172 if (clp->cl_slot_tbl) {
172 nfs4_release_slot_table(clp->cl_slot_tbl); 173 nfs4_shutdown_slot_table(clp->cl_slot_tbl);
173 kfree(clp->cl_slot_tbl); 174 kfree(clp->cl_slot_tbl);
174 } 175 }
175} 176}
@@ -370,6 +371,7 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
370 __set_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags); 371 __set_bit(NFS_CS_INFINITE_SLOTS, &clp->cl_flags);
371 __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags); 372 __set_bit(NFS_CS_DISCRTRY, &clp->cl_flags);
372 __set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags); 373 __set_bit(NFS_CS_NO_RETRANS_TIMEOUT, &clp->cl_flags);
374
373 error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_GSS_KRB5I); 375 error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_GSS_KRB5I);
374 if (error == -EINVAL) 376 if (error == -EINVAL)
375 error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX); 377 error = nfs_create_rpc_client(clp, timeparms, RPC_AUTH_UNIX);
@@ -409,13 +411,11 @@ struct nfs_client *nfs4_init_client(struct nfs_client *clp,
409 error = nfs4_discover_server_trunking(clp, &old); 411 error = nfs4_discover_server_trunking(clp, &old);
410 if (error < 0) 412 if (error < 0)
411 goto error; 413 goto error;
412 nfs_put_client(clp);
413 if (clp != old) {
414 clp->cl_preserve_clid = true;
415 clp = old;
416 }
417 414
418 return clp; 415 if (clp != old)
416 clp->cl_preserve_clid = true;
417 nfs_put_client(clp);
418 return old;
419 419
420error: 420error:
421 nfs_mark_client_ready(clp, error); 421 nfs_mark_client_ready(clp, error);
@@ -493,9 +493,10 @@ int nfs40_walk_client_list(struct nfs_client *new,
493 prev = pos; 493 prev = pos;
494 494
495 status = nfs_wait_client_init_complete(pos); 495 status = nfs_wait_client_init_complete(pos);
496 spin_lock(&nn->nfs_client_lock);
497 if (status < 0) 496 if (status < 0)
498 continue; 497 goto out;
498 status = -NFS4ERR_STALE_CLIENTID;
499 spin_lock(&nn->nfs_client_lock);
499 } 500 }
500 if (pos->cl_cons_state != NFS_CS_READY) 501 if (pos->cl_cons_state != NFS_CS_READY)
501 continue; 502 continue;
@@ -633,7 +634,8 @@ int nfs41_walk_client_list(struct nfs_client *new,
633 } 634 }
634 spin_lock(&nn->nfs_client_lock); 635 spin_lock(&nn->nfs_client_lock);
635 if (status < 0) 636 if (status < 0)
636 continue; 637 break;
638 status = -NFS4ERR_STALE_CLIENTID;
637 } 639 }
638 if (pos->cl_cons_state != NFS_CS_READY) 640 if (pos->cl_cons_state != NFS_CS_READY)
639 continue; 641 continue;
@@ -1133,6 +1135,7 @@ static int nfs_probe_destination(struct nfs_server *server)
1133 * @hostname: new end-point's hostname 1135 * @hostname: new end-point's hostname
1134 * @sap: new end-point's socket address 1136 * @sap: new end-point's socket address
1135 * @salen: size of "sap" 1137 * @salen: size of "sap"
1138 * @net: net namespace
1136 * 1139 *
1137 * The nfs_server must be quiescent before this function is invoked. 1140 * The nfs_server must be quiescent before this function is invoked.
1138 * Either its session is drained (NFSv4.1+), or its transport is 1141 * Either its session is drained (NFSv4.1+), or its transport is
@@ -1141,13 +1144,13 @@ static int nfs_probe_destination(struct nfs_server *server)
1141 * Returns zero on success, or a negative errno value. 1144 * Returns zero on success, or a negative errno value.
1142 */ 1145 */
1143int nfs4_update_server(struct nfs_server *server, const char *hostname, 1146int nfs4_update_server(struct nfs_server *server, const char *hostname,
1144 struct sockaddr *sap, size_t salen) 1147 struct sockaddr *sap, size_t salen, struct net *net)
1145{ 1148{
1146 struct nfs_client *clp = server->nfs_client; 1149 struct nfs_client *clp = server->nfs_client;
1147 struct rpc_clnt *clnt = server->client; 1150 struct rpc_clnt *clnt = server->client;
1148 struct xprt_create xargs = { 1151 struct xprt_create xargs = {
1149 .ident = clp->cl_proto, 1152 .ident = clp->cl_proto,
1150 .net = &init_net, 1153 .net = net,
1151 .dstaddr = sap, 1154 .dstaddr = sap,
1152 .addrlen = salen, 1155 .addrlen = salen,
1153 .servername = hostname, 1156 .servername = hostname,
@@ -1187,7 +1190,7 @@ int nfs4_update_server(struct nfs_server *server, const char *hostname,
1187 error = nfs4_set_client(server, hostname, sap, salen, buf, 1190 error = nfs4_set_client(server, hostname, sap, salen, buf,
1188 clp->cl_rpcclient->cl_auth->au_flavor, 1191 clp->cl_rpcclient->cl_auth->au_flavor,
1189 clp->cl_proto, clnt->cl_timeout, 1192 clp->cl_proto, clnt->cl_timeout,
1190 clp->cl_minorversion, clp->cl_net); 1193 clp->cl_minorversion, net);
1191 nfs_put_client(clp); 1194 nfs_put_client(clp);
1192 if (error != 0) { 1195 if (error != 0) {
1193 nfs_server_insert_lists(server); 1196 nfs_server_insert_lists(server);