From 46121cf7d85869bfe9588bac7ccf55aa0bc7f278 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Wed, 31 Jan 2007 12:14:08 -0500 Subject: SUNRPC: fix print format for tk_pid The tk_pid field is an unsigned short. The proper print format specifier for that type is %5u, not %4d. Also clean up some miscellaneous print formatting nits. Signed-off-by: Chuck Lever Signed-off-by: Trond Myklebust --- net/sunrpc/clnt.c | 129 +++++++++++++++++++++++++++++------------------------- 1 file changed, 69 insertions(+), 60 deletions(-) (limited to 'net/sunrpc/clnt.c') diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e9d5f3c562e5..393e70aee181 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -42,6 +42,10 @@ # define RPCDBG_FACILITY RPCDBG_CALL #endif +#define dprint_status(t) \ + dprintk("RPC: %5u %s (status %d)\n", t->tk_pid, \ + __FUNCTION__, t->tk_status) + static DECLARE_WAIT_QUEUE_HEAD(destroy_wait); @@ -106,8 +110,8 @@ static struct rpc_clnt * rpc_new_client(struct rpc_xprt *xprt, char *servname, s int err; int len; - dprintk("RPC: creating %s client for %s (xprt %p)\n", - program->name, servname, xprt); + dprintk("RPC: creating %s client for %s (xprt %p)\n", + program->name, servname, xprt); err = -EINVAL; if (!xprt) @@ -220,7 +224,7 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args) xprt->resvport = 0; dprintk("RPC: creating %s client for %s (xprt %p)\n", - args->program->name, args->servername, xprt); + args->program->name, args->servername, xprt); clnt = rpc_new_client(xprt, args->servername, args->program, args->version, args->authflavor); @@ -288,7 +292,7 @@ out_no_path: out_no_stats: kfree(new); out_no_clnt: - dprintk("RPC: %s returned error %d\n", __FUNCTION__, err); + dprintk("RPC: %s: returned error %d\n", __FUNCTION__, err); return ERR_PTR(err); } @@ -301,7 +305,7 @@ out_no_clnt: int rpc_shutdown_client(struct rpc_clnt *clnt) { - dprintk("RPC: shutting down %s client for %s, tasks=%d\n", + dprintk("RPC: shutting down %s client for %s, tasks=%d\n", clnt->cl_protname, clnt->cl_server, atomic_read(&clnt->cl_users)); @@ -336,7 +340,7 @@ rpc_destroy_client(struct rpc_clnt *clnt) return 1; BUG_ON(atomic_read(&clnt->cl_users) != 0); - dprintk("RPC: destroying %s client for %s\n", + dprintk("RPC: destroying %s client for %s\n", clnt->cl_protname, clnt->cl_server); if (clnt->cl_auth) { rpcauth_destroy(clnt->cl_auth); @@ -366,8 +370,8 @@ out_free: void rpc_release_client(struct rpc_clnt *clnt) { - dprintk("RPC: rpc_release_client(%p, %d)\n", - clnt, atomic_read(&clnt->cl_users)); + dprintk("RPC: rpc_release_client(%p, %d)\n", + clnt, atomic_read(&clnt->cl_users)); if (!atomic_dec_and_test(&clnt->cl_users)) return; @@ -654,9 +658,10 @@ call_start(struct rpc_task *task) { struct rpc_clnt *clnt = task->tk_client; - dprintk("RPC: %4d call_start %s%d proc %d (%s)\n", task->tk_pid, - clnt->cl_protname, clnt->cl_vers, task->tk_msg.rpc_proc->p_proc, - (RPC_IS_ASYNC(task) ? "async" : "sync")); + dprintk("RPC: %5u call_start %s%d proc %d (%s)\n", task->tk_pid, + clnt->cl_protname, clnt->cl_vers, + task->tk_msg.rpc_proc->p_proc, + (RPC_IS_ASYNC(task) ? "async" : "sync")); /* Increment call count */ task->tk_msg.rpc_proc->p_count++; @@ -670,7 +675,7 @@ call_start(struct rpc_task *task) static void call_reserve(struct rpc_task *task) { - dprintk("RPC: %4d call_reserve\n", task->tk_pid); + dprint_status(task); if (!rpcauth_uptodatecred(task)) { task->tk_action = call_refresh; @@ -690,8 +695,7 @@ call_reserveresult(struct rpc_task *task) { int status = task->tk_status; - dprintk("RPC: %4d call_reserveresult (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); /* * After a call to xprt_reserve(), we must have either @@ -745,8 +749,8 @@ call_allocate(struct rpc_task *task) struct rpc_xprt *xprt = task->tk_xprt; unsigned int bufsiz; - dprintk("RPC: %4d call_allocate (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); + task->tk_action = call_bind; if (req->rq_buffer) return; @@ -757,7 +761,8 @@ call_allocate(struct rpc_task *task) if (xprt->ops->buf_alloc(task, bufsiz << 1) != NULL) return; - printk(KERN_INFO "RPC: buffer allocation failed for task %p\n", task); + + dprintk("RPC: %5u rpc_buffer allocation failed\n", task->tk_pid); if (RPC_IS_ASYNC(task) || !signalled()) { xprt_release(task); @@ -794,8 +799,7 @@ call_encode(struct rpc_task *task) kxdrproc_t encode; __be32 *p; - dprintk("RPC: %4d call_encode (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); /* Default buffer setup */ bufsiz = req->rq_bufsize >> 1; @@ -841,8 +845,7 @@ call_bind(struct rpc_task *task) { struct rpc_xprt *xprt = task->tk_xprt; - dprintk("RPC: %4d call_bind (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); task->tk_action = call_connect; if (!xprt_bound(xprt)) { @@ -861,8 +864,7 @@ call_bind_status(struct rpc_task *task) int status = -EACCES; if (task->tk_status >= 0) { - dprintk("RPC: %4d call_bind_status (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); task->tk_status = 0; task->tk_action = call_connect; return; @@ -870,24 +872,24 @@ call_bind_status(struct rpc_task *task) switch (task->tk_status) { case -EACCES: - dprintk("RPC: %4d remote rpcbind: RPC program/version unavailable\n", - task->tk_pid); + dprintk("RPC: %5u remote rpcbind: RPC program/version " + "unavailable\n", task->tk_pid); rpc_delay(task, 3*HZ); goto retry_timeout; case -ETIMEDOUT: - dprintk("RPC: %4d rpcbind request timed out\n", + dprintk("RPC: %5u rpcbind request timed out\n", task->tk_pid); goto retry_timeout; case -EPFNOSUPPORT: - dprintk("RPC: %4d remote rpcbind service unavailable\n", + dprintk("RPC: %5u remote rpcbind service unavailable\n", task->tk_pid); break; case -EPROTONOSUPPORT: - dprintk("RPC: %4d remote rpcbind version 2 unavailable\n", + dprintk("RPC: %5u remote rpcbind version 2 unavailable\n", task->tk_pid); break; default: - dprintk("RPC: %4d unrecognized rpcbind error (%d)\n", + dprintk("RPC: %5u unrecognized rpcbind error (%d)\n", task->tk_pid, -task->tk_status); status = -EIO; } @@ -907,7 +909,7 @@ call_connect(struct rpc_task *task) { struct rpc_xprt *xprt = task->tk_xprt; - dprintk("RPC: %4d call_connect xprt %p %s connected\n", + dprintk("RPC: %5u call_connect xprt %p %s connected\n", task->tk_pid, xprt, (xprt_connected(xprt) ? "is" : "is not")); @@ -929,8 +931,7 @@ call_connect_status(struct rpc_task *task) struct rpc_clnt *clnt = task->tk_client; int status = task->tk_status; - dprintk("RPC: %5u call_connect_status (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); task->tk_status = 0; if (status >= 0) { @@ -962,8 +963,7 @@ call_connect_status(struct rpc_task *task) static void call_transmit(struct rpc_task *task) { - dprintk("RPC: %4d call_transmit (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); task->tk_action = call_status; if (task->tk_status < 0) @@ -1024,8 +1024,7 @@ call_status(struct rpc_task *task) if (req->rq_received > 0 && !req->rq_bytes_sent) task->tk_status = req->rq_received; - dprintk("RPC: %4d call_status (status %d)\n", - task->tk_pid, task->tk_status); + dprint_status(task); status = task->tk_status; if (status >= 0) { @@ -1076,11 +1075,11 @@ call_timeout(struct rpc_task *task) struct rpc_clnt *clnt = task->tk_client; if (xprt_adjust_timeout(task->tk_rqstp) == 0) { - dprintk("RPC: %4d call_timeout (minor)\n", task->tk_pid); + dprintk("RPC: %5u call_timeout (minor)\n", task->tk_pid); goto retry; } - dprintk("RPC: %4d call_timeout (major)\n", task->tk_pid); + dprintk("RPC: %5u call_timeout (major)\n", task->tk_pid); task->tk_timeouts++; if (RPC_IS_SOFT(task)) { @@ -1114,8 +1113,8 @@ call_decode(struct rpc_task *task) kxdrproc_t decode = task->tk_msg.rpc_proc->p_decode; __be32 *p; - dprintk("RPC: %4d call_decode (status %d)\n", - task->tk_pid, task->tk_status); + dprintk("RPC: %5u call_decode (status %d)\n", + task->tk_pid, task->tk_status); if (task->tk_flags & RPC_CALL_MAJORSEEN) { printk(KERN_NOTICE "%s: server %s OK\n", @@ -1129,8 +1128,8 @@ call_decode(struct rpc_task *task) clnt->cl_stats->rpcretrans++; goto out_retry; } - dprintk("%s: too small RPC reply size (%d bytes)\n", - clnt->cl_protname, task->tk_status); + dprintk("RPC: %s: too small RPC reply size (%d bytes)\n", + clnt->cl_protname, task->tk_status); task->tk_action = call_timeout; goto out_retry; } @@ -1162,8 +1161,8 @@ call_decode(struct rpc_task *task) task->tk_msg.rpc_resp); unlock_kernel(); } - dprintk("RPC: %4d call_decode result %d\n", task->tk_pid, - task->tk_status); + dprintk("RPC: %5u call_decode result %d\n", task->tk_pid, + task->tk_status); return; out_retry: req->rq_received = req->rq_private_buf.len = 0; @@ -1176,7 +1175,7 @@ out_retry: static void call_refresh(struct rpc_task *task) { - dprintk("RPC: %4d call_refresh\n", task->tk_pid); + dprint_status(task); xprt_release(task); /* Must do to obtain new XID */ task->tk_action = call_refreshresult; @@ -1192,8 +1191,8 @@ static void call_refreshresult(struct rpc_task *task) { int status = task->tk_status; - dprintk("RPC: %4d call_refreshresult (status %d)\n", - task->tk_pid, task->tk_status); + + dprint_status(task); task->tk_status = 0; task->tk_action = call_reserve; @@ -1271,11 +1270,15 @@ call_verify(struct rpc_task *task) case RPC_AUTH_ERROR: break; case RPC_MISMATCH: - dprintk("%s: RPC call version mismatch!\n", __FUNCTION__); + dprintk("RPC: %5u %s: RPC call version " + "mismatch!\n", + task->tk_pid, __FUNCTION__); error = -EPROTONOSUPPORT; goto out_err; default: - dprintk("%s: RPC call rejected, unknown error: %x\n", __FUNCTION__, n); + dprintk("RPC: %5u %s: RPC call rejected, " + "unknown error: %x\n", + task->tk_pid, __FUNCTION__, n); goto out_eio; } if (--len < 0) @@ -1288,8 +1291,8 @@ call_verify(struct rpc_task *task) if (!task->tk_cred_retry) break; task->tk_cred_retry--; - dprintk("RPC: %4d call_verify: retry stale creds\n", - task->tk_pid); + dprintk("RPC: %5u %s: retry stale creds\n", + task->tk_pid, __FUNCTION__); rpcauth_invalcred(task); task->tk_action = call_refresh; goto out_retry; @@ -1299,8 +1302,8 @@ call_verify(struct rpc_task *task) if (!task->tk_garb_retry) break; task->tk_garb_retry--; - dprintk("RPC: %4d call_verify: retry garbled creds\n", - task->tk_pid); + dprintk("RPC: %5u %s: retry garbled creds\n", + task->tk_pid, __FUNCTION__); task->tk_action = call_bind; goto out_retry; case RPC_AUTH_TOOWEAK: @@ -1311,8 +1314,8 @@ call_verify(struct rpc_task *task) printk(KERN_WARNING "call_verify: unknown auth error: %x\n", n); error = -EIO; } - dprintk("RPC: %4d call_verify: call rejected %d\n", - task->tk_pid, n); + dprintk("RPC: %5u %s: call rejected %d\n", + task->tk_pid, __FUNCTION__, n); goto out_err; } if (!(p = rpcauth_checkverf(task, p))) { @@ -1326,20 +1329,24 @@ call_verify(struct rpc_task *task) case RPC_SUCCESS: return p; case RPC_PROG_UNAVAIL: - dprintk("RPC: call_verify: program %u is unsupported by server %s\n", + dprintk("RPC: %5u %s: program %u is unsupported by server %s\n", + task->tk_pid, __FUNCTION__, (unsigned int)task->tk_client->cl_prog, task->tk_client->cl_server); error = -EPFNOSUPPORT; goto out_err; case RPC_PROG_MISMATCH: - dprintk("RPC: call_verify: program %u, version %u unsupported by server %s\n", + dprintk("RPC: %5u %s: program %u, version %u unsupported by " + "server %s\n", task->tk_pid, __FUNCTION__, (unsigned int)task->tk_client->cl_prog, (unsigned int)task->tk_client->cl_vers, task->tk_client->cl_server); error = -EPROTONOSUPPORT; goto out_err; case RPC_PROC_UNAVAIL: - dprintk("RPC: call_verify: proc %p unsupported by program %u, version %u on server %s\n", + dprintk("RPC: %5u %s: proc %p unsupported by program %u, " + "version %u on server %s\n", + task->tk_pid, __FUNCTION__, task->tk_msg.rpc_proc, task->tk_client->cl_prog, task->tk_client->cl_vers, @@ -1347,7 +1354,8 @@ call_verify(struct rpc_task *task) error = -EOPNOTSUPP; goto out_err; case RPC_GARBAGE_ARGS: - dprintk("RPC: %4d %s: server saw garbage\n", task->tk_pid, __FUNCTION__); + dprintk("RPC: %5u %s: server saw garbage\n", + task->tk_pid, __FUNCTION__); break; /* retry */ default: printk(KERN_WARNING "call_verify: server accept status: %x\n", n); @@ -1358,7 +1366,8 @@ out_garbage: task->tk_client->cl_stats->rpcgarbage++; if (task->tk_garb_retry) { task->tk_garb_retry--; - dprintk("RPC %s: retrying %4d\n", __FUNCTION__, task->tk_pid); + dprintk("RPC: %5u %s: retrying\n", + task->tk_pid, __FUNCTION__); task->tk_action = call_bind; out_retry: return ERR_PTR(-EAGAIN); -- cgit v1.2.3