diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2008-01-11 17:09:52 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-01-30 02:06:07 -0500 |
commit | 9289e7f91add1c09c3ec8571a2080f7507730b8d (patch) | |
tree | f8fd567e331b02efda2e09986fdfb37c1461dfc8 /fs | |
parent | 52c4044d00fe703eb3fb18e0d8dfd1c196eb28be (diff) |
NFS: Invoke nlmclnt_init during NFS mount processing
Cache an appropriate nlm_host structure in the NFS client's mount point
metadata for later use.
Note that there is no need to set NFS_MOUNT_NONLM in the error case -- if
nfs_start_lockd() returns a non-zero value, its callers ensure that the
mount request fails outright.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/client.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 18fcb05a0707..0b3ce86f6fc9 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -458,7 +458,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp, | |||
458 | static void nfs_destroy_server(struct nfs_server *server) | 458 | static void nfs_destroy_server(struct nfs_server *server) |
459 | { | 459 | { |
460 | if (!(server->flags & NFS_MOUNT_NONLM)) | 460 | if (!(server->flags & NFS_MOUNT_NONLM)) |
461 | lockd_down(); /* release rpc.lockd */ | 461 | nlmclnt_done(server->nlm_host); |
462 | } | 462 | } |
463 | 463 | ||
464 | /* | 464 | /* |
@@ -466,20 +466,26 @@ static void nfs_destroy_server(struct nfs_server *server) | |||
466 | */ | 466 | */ |
467 | static int nfs_start_lockd(struct nfs_server *server) | 467 | static int nfs_start_lockd(struct nfs_server *server) |
468 | { | 468 | { |
469 | int error = 0; | 469 | struct nlm_host *host; |
470 | struct nfs_client *clp = server->nfs_client; | ||
471 | u32 nfs_version = clp->rpc_ops->version; | ||
472 | unsigned short protocol = server->flags & NFS_MOUNT_TCP ? | ||
473 | IPPROTO_TCP : IPPROTO_UDP; | ||
470 | 474 | ||
471 | if (server->nfs_client->rpc_ops->version > 3) | 475 | if (nfs_version > 3) |
472 | goto out; | 476 | return 0; |
473 | if (server->flags & NFS_MOUNT_NONLM) | 477 | if (server->flags & NFS_MOUNT_NONLM) |
474 | goto out; | 478 | return 0; |
475 | error = lockd_up((server->flags & NFS_MOUNT_TCP) ? | 479 | |
476 | IPPROTO_TCP : IPPROTO_UDP); | 480 | host = nlmclnt_init(clp->cl_hostname, |
477 | if (error < 0) | 481 | (struct sockaddr *)&clp->cl_addr, |
478 | server->flags |= NFS_MOUNT_NONLM; | 482 | clp->cl_addrlen, protocol, nfs_version); |
479 | else | 483 | if (IS_ERR(host)) |
480 | server->destroy = nfs_destroy_server; | 484 | return PTR_ERR(host); |
481 | out: | 485 | |
482 | return error; | 486 | server->nlm_host = host; |
487 | server->destroy = nfs_destroy_server; | ||
488 | return 0; | ||
483 | } | 489 | } |
484 | 490 | ||
485 | /* | 491 | /* |