Commit 5efd1876 authored by Trond Myklebust's avatar Trond Myklebust Committed by Anna Schumaker

SUNRPC: Fix up tracking of timeouts

Add a helper to ensure that debugfs and friends print out the
correct current task timeout value.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 6b2e6856
...@@ -226,6 +226,7 @@ void rpc_execute(struct rpc_task *); ...@@ -226,6 +226,7 @@ void rpc_execute(struct rpc_task *);
void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *);
void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); void rpc_init_wait_queue(struct rpc_wait_queue *, const char *);
void rpc_destroy_wait_queue(struct rpc_wait_queue *); void rpc_destroy_wait_queue(struct rpc_wait_queue *);
unsigned long rpc_task_timeout(const struct rpc_task *task);
void rpc_sleep_on_timeout(struct rpc_wait_queue *queue, void rpc_sleep_on_timeout(struct rpc_wait_queue *queue,
struct rpc_task *task, struct rpc_task *task,
rpc_action action, rpc_action action,
......
...@@ -186,7 +186,7 @@ DECLARE_EVENT_CLASS(rpc_task_queued, ...@@ -186,7 +186,7 @@ DECLARE_EVENT_CLASS(rpc_task_queued,
__entry->client_id = task->tk_client ? __entry->client_id = task->tk_client ?
task->tk_client->cl_clid : -1; task->tk_client->cl_clid : -1;
__entry->task_id = task->tk_pid; __entry->task_id = task->tk_pid;
__entry->timeout = task->tk_timeout; __entry->timeout = rpc_task_timeout(task);
__entry->runstate = task->tk_runstate; __entry->runstate = task->tk_runstate;
__entry->status = task->tk_status; __entry->status = task->tk_status;
__entry->flags = task->tk_flags; __entry->flags = task->tk_flags;
......
...@@ -2874,7 +2874,7 @@ static void rpc_show_task(const struct rpc_clnt *clnt, ...@@ -2874,7 +2874,7 @@ static void rpc_show_task(const struct rpc_clnt *clnt,
printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%ps q:%s\n", printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%ps q:%s\n",
task->tk_pid, task->tk_flags, task->tk_status, task->tk_pid, task->tk_flags, task->tk_status,
clnt, task->tk_rqstp, task->tk_timeout, task->tk_ops, clnt, task->tk_rqstp, rpc_task_timeout(task), task->tk_ops,
clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task), clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task),
task->tk_action, rpc_waitq); task->tk_action, rpc_waitq);
} }
......
...@@ -33,7 +33,7 @@ tasks_show(struct seq_file *f, void *v) ...@@ -33,7 +33,7 @@ tasks_show(struct seq_file *f, void *v)
seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n", seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n",
task->tk_pid, task->tk_flags, task->tk_status, task->tk_pid, task->tk_flags, task->tk_status,
clnt->cl_clid, xid, task->tk_timeout, task->tk_ops, clnt->cl_clid, xid, rpc_task_timeout(task), task->tk_ops,
clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task), clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task),
task->tk_action, rpc_waitq); task->tk_action, rpc_waitq);
return 0; return 0;
......
...@@ -58,6 +58,20 @@ static struct rpc_wait_queue delay_queue; ...@@ -58,6 +58,20 @@ static struct rpc_wait_queue delay_queue;
struct workqueue_struct *rpciod_workqueue __read_mostly; struct workqueue_struct *rpciod_workqueue __read_mostly;
struct workqueue_struct *xprtiod_workqueue __read_mostly; struct workqueue_struct *xprtiod_workqueue __read_mostly;
unsigned long
rpc_task_timeout(const struct rpc_task *task)
{
unsigned long timeout = READ_ONCE(task->tk_timeout);
if (timeout != 0) {
unsigned long now = jiffies;
if (time_before(now, timeout))
return timeout - now;
}
return 0;
}
EXPORT_SYMBOL_GPL(rpc_task_timeout);
/* /*
* Disable the timer for a given RPC task. Should be called with * Disable the timer for a given RPC task. Should be called with
* queue->lock and bh_disabled in order to avoid races within * queue->lock and bh_disabled in order to avoid races within
......
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