Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>

authored by

Trond Myklebust and committed by
Anna Schumaker
5efd1876 6b2e6856

+18 -3
+1
include/linux/sunrpc/sched.h
··· 226 226 void rpc_init_priority_wait_queue(struct rpc_wait_queue *, const char *); 227 227 void rpc_init_wait_queue(struct rpc_wait_queue *, const char *); 228 228 void rpc_destroy_wait_queue(struct rpc_wait_queue *); 229 + unsigned long rpc_task_timeout(const struct rpc_task *task); 229 230 void rpc_sleep_on_timeout(struct rpc_wait_queue *queue, 230 231 struct rpc_task *task, 231 232 rpc_action action,
+1 -1
include/trace/events/sunrpc.h
··· 186 186 __entry->client_id = task->tk_client ? 187 187 task->tk_client->cl_clid : -1; 188 188 __entry->task_id = task->tk_pid; 189 - __entry->timeout = task->tk_timeout; 189 + __entry->timeout = rpc_task_timeout(task); 190 190 __entry->runstate = task->tk_runstate; 191 191 __entry->status = task->tk_status; 192 192 __entry->flags = task->tk_flags;
+1 -1
net/sunrpc/clnt.c
··· 2874 2874 2875 2875 printk(KERN_INFO "%5u %04x %6d %8p %8p %8ld %8p %sv%u %s a:%ps q:%s\n", 2876 2876 task->tk_pid, task->tk_flags, task->tk_status, 2877 - clnt, task->tk_rqstp, task->tk_timeout, task->tk_ops, 2877 + clnt, task->tk_rqstp, rpc_task_timeout(task), task->tk_ops, 2878 2878 clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task), 2879 2879 task->tk_action, rpc_waitq); 2880 2880 }
+1 -1
net/sunrpc/debugfs.c
··· 33 33 34 34 seq_printf(f, "%5u %04x %6d 0x%x 0x%x %8ld %ps %sv%u %s a:%ps q:%s\n", 35 35 task->tk_pid, task->tk_flags, task->tk_status, 36 - clnt->cl_clid, xid, task->tk_timeout, task->tk_ops, 36 + clnt->cl_clid, xid, rpc_task_timeout(task), task->tk_ops, 37 37 clnt->cl_program->name, clnt->cl_vers, rpc_proc_name(task), 38 38 task->tk_action, rpc_waitq); 39 39 return 0;
+14
net/sunrpc/sched.c
··· 58 58 struct workqueue_struct *rpciod_workqueue __read_mostly; 59 59 struct workqueue_struct *xprtiod_workqueue __read_mostly; 60 60 61 + unsigned long 62 + rpc_task_timeout(const struct rpc_task *task) 63 + { 64 + unsigned long timeout = READ_ONCE(task->tk_timeout); 65 + 66 + if (timeout != 0) { 67 + unsigned long now = jiffies; 68 + if (time_before(now, timeout)) 69 + return timeout - now; 70 + } 71 + return 0; 72 + } 73 + EXPORT_SYMBOL_GPL(rpc_task_timeout); 74 + 61 75 /* 62 76 * Disable the timer for a given RPC task. Should be called with 63 77 * queue->lock and bh_disabled in order to avoid races within