summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/sched.c
diff options
context:
space:
mode:
authorTrond Myklebust <trondmy@gmail.com>2019-04-07 19:58:50 +0200
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-04-25 20:18:13 +0200
commit5efd1876e61fe61b61e2d056782027c11bcd0982 (patch)
tree9afae17805a7fc06ecce13abc6c969e11fabaef9 /net/sunrpc/sched.c
parentSUNRPC: Add function rpc_sleep_on_timeout() (diff)
downloadlinux-5efd1876e61fe61b61e2d056782027c11bcd0982.tar.xz
linux-5efd1876e61fe61b61e2d056782027c11bcd0982.zip
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>
Diffstat (limited to '')
-rw-r--r--net/sunrpc/sched.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c
index 7e0f7b83262f..40944c34a9e4 100644
--- a/net/sunrpc/sched.c
+++ b/net/sunrpc/sched.c
@@ -58,6 +58,20 @@ static struct rpc_wait_queue delay_queue;
struct workqueue_struct *rpciod_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
* queue->lock and bh_disabled in order to avoid races within