Commit 9289e7f9 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

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: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 52c4044d
...@@ -458,7 +458,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp, ...@@ -458,7 +458,7 @@ static int nfs_create_rpc_client(struct nfs_client *clp,
static void nfs_destroy_server(struct nfs_server *server) static void nfs_destroy_server(struct nfs_server *server)
{ {
if (!(server->flags & NFS_MOUNT_NONLM)) if (!(server->flags & NFS_MOUNT_NONLM))
lockd_down(); /* release rpc.lockd */ nlmclnt_done(server->nlm_host);
} }
/* /*
...@@ -466,20 +466,26 @@ static void nfs_destroy_server(struct nfs_server *server) ...@@ -466,20 +466,26 @@ static void nfs_destroy_server(struct nfs_server *server)
*/ */
static int nfs_start_lockd(struct nfs_server *server) static int nfs_start_lockd(struct nfs_server *server)
{ {
int error = 0; struct nlm_host *host;
struct nfs_client *clp = server->nfs_client;
u32 nfs_version = clp->rpc_ops->version;
unsigned short protocol = server->flags & NFS_MOUNT_TCP ?
IPPROTO_TCP : IPPROTO_UDP;
if (server->nfs_client->rpc_ops->version > 3) if (nfs_version > 3)
goto out; return 0;
if (server->flags & NFS_MOUNT_NONLM) if (server->flags & NFS_MOUNT_NONLM)
goto out; return 0;
error = lockd_up((server->flags & NFS_MOUNT_TCP) ?
IPPROTO_TCP : IPPROTO_UDP); host = nlmclnt_init(clp->cl_hostname,
if (error < 0) (struct sockaddr *)&clp->cl_addr,
server->flags |= NFS_MOUNT_NONLM; clp->cl_addrlen, protocol, nfs_version);
else if (IS_ERR(host))
server->destroy = nfs_destroy_server; return PTR_ERR(host);
out:
return error; server->nlm_host = host;
server->destroy = nfs_destroy_server;
return 0;
} }
/* /*
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <asm/atomic.h> #include <asm/atomic.h>
struct nfs_iostats; struct nfs_iostats;
struct nlm_host;
/* /*
* The nfs_client identifies our client state to the server. * The nfs_client identifies our client state to the server.
...@@ -80,6 +81,7 @@ struct nfs_server { ...@@ -80,6 +81,7 @@ struct nfs_server {
struct list_head master_link; /* link in master servers list */ struct list_head master_link; /* link in master servers list */
struct rpc_clnt * client; /* RPC client handle */ struct rpc_clnt * client; /* RPC client handle */
struct rpc_clnt * client_acl; /* ACL RPC client handle */ struct rpc_clnt * client_acl; /* ACL RPC client handle */
struct nlm_host *nlm_host; /* NLM client handle */
struct nfs_iostats * io_stats; /* I/O statistics */ struct nfs_iostats * io_stats; /* I/O statistics */
struct backing_dev_info backing_dev_info; struct backing_dev_info backing_dev_info;
atomic_long_t writeback; /* number of writeback pages */ atomic_long_t writeback; /* number of writeback pages */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment