*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/init.h>
return NULL;
}
+static void nfs4_shutdown_client(struct nfs_client *clp)
+{
+#ifdef CONFIG_NFS_V4
+ if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state))
+ nfs4_kill_renewd(clp);
+ while (!list_empty(&clp->cl_unused)) {
+ struct nfs4_state_owner *sp;
+
+ sp = list_entry(clp->cl_unused.next,
+ struct nfs4_state_owner,
+ so_list);
+ list_del(&sp->so_list);
+ kfree(sp);
+ }
+ BUG_ON(!list_empty(&clp->cl_state_owners));
+ if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state))
+ nfs_idmap_delete(clp);
+#endif
+}
+
/*
* Destroy a shared client record
*/
{
dprintk("--> nfs_free_client(%d)\n", clp->cl_nfsversion);
-#ifdef CONFIG_NFS_V4
- if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state)) {
- while (!list_empty(&clp->cl_unused)) {
- struct nfs4_state_owner *sp;
-
- sp = list_entry(clp->cl_unused.next,
- struct nfs4_state_owner,
- so_list);
- list_del(&sp->so_list);
- kfree(sp);
- }
- BUG_ON(!list_empty(&clp->cl_state_owners));
- nfs_idmap_delete(clp);
- }
-#endif
+ nfs4_shutdown_client(clp);
/* -EIO all pending I/O */
if (!IS_ERR(clp->cl_rpcclient))
clp = __nfs_find_client(addr, nfsversion);
spin_unlock(&nfs_client_lock);
- BUG_ON(clp->cl_cons_state == 0);
+ BUG_ON(clp && clp->cl_cons_state == 0);
return clp;
}
if (new)
nfs_free_client(new);
- if (clp->cl_cons_state == NFS_CS_INITING) {
- DECLARE_WAITQUEUE(myself, current);
-
- add_wait_queue(&nfs_client_active_wq, &myself);
-
- for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
- if (signal_pending(current) ||
- clp->cl_cons_state > NFS_CS_READY)
- break;
- schedule();
- }
-
- remove_wait_queue(&nfs_client_active_wq, &myself);
-
- if (signal_pending(current)) {
- nfs_put_client(clp);
- return ERR_PTR(-ERESTARTSYS);
- }
+ error = wait_event_interruptible(nfs_client_active_wq,
+ clp->cl_cons_state != NFS_CS_INITING);
+ if (error < 0) {
+ nfs_put_client(clp);
+ return ERR_PTR(-ERESTARTSYS);
}
if (clp->cl_cons_state < NFS_CS_READY) {
rpc_authflavor_t flavor)
{
struct rpc_timeout timeparms;
- struct rpc_xprt *xprt = NULL;
struct rpc_clnt *clnt = NULL;
+ struct rpc_create_args args = {
+ .protocol = proto,
+ .address = (struct sockaddr *)&clp->cl_addr,
+ .addrsize = sizeof(clp->cl_addr),
+ .timeout = &timeparms,
+ .servername = clp->cl_hostname,
+ .program = &nfs_program,
+ .version = clp->rpc_ops->version,
+ .authflavor = flavor,
+ };
if (!IS_ERR(clp->cl_rpcclient))
return 0;
clp->retrans_timeo = timeparms.to_initval;
clp->retrans_count = timeparms.to_retries;
- /* create transport and client */
- xprt = xprt_create_proto(proto, &clp->cl_addr, &timeparms);
- if (IS_ERR(xprt)) {
- dprintk("%s: cannot create RPC transport. Error = %ld\n",
- __FUNCTION__, PTR_ERR(xprt));
- return PTR_ERR(xprt);
- }
-
- /* Bind to a reserved port! */
- xprt->resvport = 1;
- /* Create the client RPC handle */
- clnt = rpc_create_client(xprt, clp->cl_hostname, &nfs_program,
- clp->rpc_ops->version, RPC_AUTH_UNIX);
+ clnt = rpc_create(&args);
if (IS_ERR(clnt)) {
dprintk("%s: cannot create RPC client. Error = %ld\n",
__FUNCTION__, PTR_ERR(clnt));
return PTR_ERR(clnt);
}
- clnt->cl_intr = 1;
- clnt->cl_softrtry = 1;
clp->cl_rpcclient = clnt;
return 0;
}
goto out;
if (server->flags & NFS_MOUNT_NONLM)
goto out;
- error = lockd_up();
+ error = lockd_up((server->flags & NFS_MOUNT_TCP) ?
+ IPPROTO_TCP : IPPROTO_UDP);
if (error < 0)
server->flags |= NFS_MOUNT_NONLM;
else
}
memcpy(&server->fsid, &fattr.fsid, sizeof(server->fsid));
- dprintk("Server FSID: %llx:%llx\n", server->fsid.major, server->fsid.minor);
+ dprintk("Server FSID: %llx:%llx\n",
+ (unsigned long long) server->fsid.major,
+ (unsigned long long) server->fsid.minor);
BUG_ON(!server->nfs_client);
BUG_ON(!server->nfs_client->rpc_ops);
if (error < 0)
goto error;
- dprintk("Server FSID: %llx:%llx\n", server->fsid.major, server->fsid.minor);
+ dprintk("Server FSID: %llx:%llx\n",
+ (unsigned long long) server->fsid.major,
+ (unsigned long long) server->fsid.minor);
dprintk("Mount FH: %d\n", mntfh->size);
error = nfs_probe_fsinfo(server, mntfh, &fattr);
parent_server->client->cl_xprt->prot,
parent_client->retrans_timeo,
parent_client->retrans_count);
+ if (error < 0)
+ goto error;
/* Initialise the client representation from the parent server */
nfs_server_copy_userdata(server, parent_server);
goto error;
dprintk("Referral FSID: %llx:%llx\n",
- server->fsid.major, server->fsid.minor);
+ (unsigned long long) server->fsid.major,
+ (unsigned long long) server->fsid.minor);
spin_lock(&nfs_client_lock);
list_add_tail(&server->client_link, &server->nfs_client->cl_superblocks);
int error;
dprintk("--> nfs_clone_server(,%llx:%llx,)\n",
- fattr->fsid.major, fattr->fsid.minor);
+ (unsigned long long) fattr->fsid.major,
+ (unsigned long long) fattr->fsid.minor);
server = nfs_alloc_server();
if (!server)
goto out_free_server;
dprintk("Cloned FSID: %llx:%llx\n",
- server->fsid.major, server->fsid.minor);
+ (unsigned long long) server->fsid.major,
+ (unsigned long long) server->fsid.minor);
error = nfs_start_lockd(server);
if (error < 0)
MAJOR(server->s_dev), MINOR(server->s_dev));
snprintf(fsid, 17, "%llx:%llx",
- server->fsid.major, server->fsid.minor);
+ (unsigned long long) server->fsid.major,
+ (unsigned long long) server->fsid.minor);
seq_printf(m, "v%d %02x%02x%02x%02x %4hx %-7s %-17s\n",
clp->cl_nfsversion,