aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-01-11 17:09:52 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:06:07 -0500
commit9289e7f91add1c09c3ec8571a2080f7507730b8d (patch)
treef8fd567e331b02efda2e09986fdfb37c1461dfc8
parent52c4044d00fe703eb3fb18e0d8dfd1c196eb28be (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>
-rw-r--r--fs/nfs/client.c32
-rw-r--r--include/linux/nfs_fs_sb.h2
2 files changed, 21 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,
458static void nfs_destroy_server(struct nfs_server *server) 458static 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 */
467static int nfs_start_lockd(struct nfs_server *server) 467static 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);
481out: 485
482 return error; 486 server->nlm_host = host;
487 server->destroy = nfs_destroy_server;
488 return 0;
483} 489}
484 490
485/* 491/*
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b5ba5f79485d..3423c6761bf7 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -8,6 +8,7 @@
8#include <asm/atomic.h> 8#include <asm/atomic.h>
9 9
10struct nfs_iostats; 10struct nfs_iostats;
11struct nlm_host;
11 12
12/* 13/*
13 * The nfs_client identifies our client state to the server. 14 * The nfs_client identifies our client state to the server.
@@ -80,6 +81,7 @@ struct nfs_server {
80 struct list_head master_link; /* link in master servers list */ 81 struct list_head master_link; /* link in master servers list */
81 struct rpc_clnt * client; /* RPC client handle */ 82 struct rpc_clnt * client; /* RPC client handle */
82 struct rpc_clnt * client_acl; /* ACL RPC client handle */ 83 struct rpc_clnt * client_acl; /* ACL RPC client handle */
84 struct nlm_host *nlm_host; /* NLM client handle */
83 struct nfs_iostats * io_stats; /* I/O statistics */ 85 struct nfs_iostats * io_stats; /* I/O statistics */
84 struct backing_dev_info backing_dev_info; 86 struct backing_dev_info backing_dev_info;
85 atomic_long_t writeback; /* number of writeback pages */ 87 atomic_long_t writeback; /* number of writeback pages */