diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-06-19 22:45:37 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-06-19 22:45:37 +0000 |
commit | 6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch) | |
tree | 0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /net/sunrpc/clnt.c | |
parent | ecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff) |
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine
status unknown.
Diffstat (limited to 'net/sunrpc/clnt.c')
-rw-r--r-- | net/sunrpc/clnt.c | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index c41dfc1eb..ce93ab71c 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -22,7 +22,6 @@ */ #include <asm/system.h> -#include <asm/segment.h> #include <linux/types.h> #include <linux/mm.h> @@ -35,7 +34,7 @@ #include <linux/nfs.h> -#define RPC_SLACK_SPACE 1024 /* total overkill */ +#define RPC_SLACK_SPACE 512 /* total overkill */ #ifdef RPC_DEBUG # define RPCDBG_FACILITY RPCDBG_CALL @@ -91,6 +90,7 @@ rpc_create_client(struct rpc_xprt *xprt, char *servname, if (!clnt) goto out_no_clnt; memset(clnt, 0, sizeof(*clnt)); + atomic_set(&clnt->cl_users, 0); clnt->cl_xprt = xprt; clnt->cl_procinfo = version->procs; @@ -140,16 +140,16 @@ rpc_shutdown_client(struct rpc_clnt *clnt) { dprintk("RPC: shutting down %s client for %s\n", clnt->cl_protname, clnt->cl_server); - while (clnt->cl_users) { + while (atomic_read(&clnt->cl_users)) { #ifdef RPC_DEBUG dprintk("RPC: rpc_shutdown_client: client %s, tasks=%d\n", - clnt->cl_protname, clnt->cl_users); + clnt->cl_protname, atomic_read(&clnt->cl_users)); #endif /* Don't let rpc_release_client destroy us */ clnt->cl_oneshot = 0; clnt->cl_dead = 0; rpc_killall_tasks(clnt); - sleep_on(&destroy_wait); + sleep_on_timeout(&destroy_wait, 1*HZ); } return rpc_destroy_client(clnt); } @@ -182,14 +182,10 @@ void rpc_release_client(struct rpc_clnt *clnt) { dprintk("RPC: rpc_release_client(%p, %d)\n", - clnt, clnt->cl_users); - if (clnt->cl_users) { - if (--(clnt->cl_users) > 0) - return; - } else - printk("rpc_release_client: %s client already free??\n", - clnt->cl_protname); + clnt, atomic_read(&clnt->cl_users)); + if (!atomic_dec_and_test(&clnt->cl_users)) + return; wake_up(&destroy_wait); if (clnt->cl_oneshot || clnt->cl_dead) rpc_destroy_client(clnt); @@ -446,7 +442,7 @@ call_allocate(struct rpc_task *task) * auth->au_wslack */ bufsiz = rpcproc_bufsiz(clnt, task->tk_msg.rpc_proc) + RPC_SLACK_SPACE; - if ((task->tk_buffer = rpc_malloc(task, bufsiz)) != NULL) + if ((task->tk_buffer = rpc_malloc(task, bufsiz << 1)) != NULL) return; printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task); @@ -480,11 +476,11 @@ call_encode(struct rpc_task *task) /* Default buffer setup */ bufsiz = rpcproc_bufsiz(clnt, task->tk_msg.rpc_proc)+RPC_SLACK_SPACE; - req->rq_svec[0].iov_base = task->tk_buffer; + req->rq_svec[0].iov_base = (void *)task->tk_buffer; req->rq_svec[0].iov_len = bufsiz; req->rq_slen = 0; req->rq_snr = 1; - req->rq_rvec[0].iov_base = task->tk_buffer; + req->rq_rvec[0].iov_base = (void *)((char *)task->tk_buffer + bufsiz); req->rq_rvec[0].iov_len = bufsiz; req->rq_rlen = bufsiz; req->rq_rnr = 1; @@ -656,9 +652,11 @@ call_timeout(struct rpc_task *task) if (req) printk(KERN_NOTICE "%s: server %s not responding, still trying\n", clnt->cl_protname, clnt->cl_server); +#ifdef RPC_DEBUG else printk(KERN_NOTICE "%s: task %d can't get a request slot\n", clnt->cl_protname, task->tk_pid); +#endif } if (clnt->cl_autobind) clnt->cl_port = 0; @@ -774,12 +772,13 @@ call_header(struct rpc_task *task) { struct rpc_clnt *clnt = task->tk_client; struct rpc_xprt *xprt = clnt->cl_xprt; - u32 *p = task->tk_buffer; + struct rpc_rqst *req = task->tk_rqstp; + u32 *p = req->rq_svec[0].iov_base; /* FIXME: check buffer size? */ if (xprt->stream) *p++ = 0; /* fill in later */ - *p++ = task->tk_rqstp->rq_xid; /* XID */ + *p++ = req->rq_xid; /* XID */ *p++ = htonl(RPC_CALL); /* CALL */ *p++ = htonl(RPC_VERSION); /* RPC version */ *p++ = htonl(clnt->cl_prog); /* program number */ @@ -794,7 +793,7 @@ call_header(struct rpc_task *task) static u32 * call_verify(struct rpc_task *task) { - u32 *p = task->tk_buffer, n; + u32 *p = task->tk_rqstp->rq_rvec[0].iov_base, n; p += 1; /* skip XID */ @@ -860,7 +859,7 @@ garbage: task->tk_client->cl_stats->rpcgarbage++; if (task->tk_garb_retry) { task->tk_garb_retry--; - printk(KERN_WARNING "RPC: garbage, retrying %4d\n", task->tk_pid); + dprintk(KERN_WARNING "RPC: garbage, retrying %4d\n", task->tk_pid); task->tk_action = call_encode; return NULL; } |