Commit 1fab7dc4 authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC: Don't start a timer on an already queued rpc task

Move the test for whether a task is already queued to prevent
corruption of the timer list in __rpc_sleep_on_priority_timeout().
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 44ea8dfc
...@@ -204,10 +204,6 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue, ...@@ -204,10 +204,6 @@ static void __rpc_add_wait_queue(struct rpc_wait_queue *queue,
struct rpc_task *task, struct rpc_task *task,
unsigned char queue_priority) unsigned char queue_priority)
{ {
WARN_ON_ONCE(RPC_IS_QUEUED(task));
if (RPC_IS_QUEUED(task))
return;
INIT_LIST_HEAD(&task->u.tk_wait.timer_list); INIT_LIST_HEAD(&task->u.tk_wait.timer_list);
if (RPC_IS_PRIORITY(queue)) if (RPC_IS_PRIORITY(queue))
__rpc_add_wait_queue_priority(queue, task, queue_priority); __rpc_add_wait_queue_priority(queue, task, queue_priority);
...@@ -382,7 +378,7 @@ static void rpc_make_runnable(struct workqueue_struct *wq, ...@@ -382,7 +378,7 @@ static void rpc_make_runnable(struct workqueue_struct *wq,
* NB: An RPC task will only receive interrupt-driven events as long * NB: An RPC task will only receive interrupt-driven events as long
* as it's on a wait queue. * as it's on a wait queue.
*/ */
static void __rpc_sleep_on_priority(struct rpc_wait_queue *q, static void __rpc_do_sleep_on_priority(struct rpc_wait_queue *q,
struct rpc_task *task, struct rpc_task *task,
unsigned char queue_priority) unsigned char queue_priority)
{ {
...@@ -395,12 +391,23 @@ static void __rpc_sleep_on_priority(struct rpc_wait_queue *q, ...@@ -395,12 +391,23 @@ static void __rpc_sleep_on_priority(struct rpc_wait_queue *q,
} }
static void __rpc_sleep_on_priority(struct rpc_wait_queue *q,
struct rpc_task *task,
unsigned char queue_priority)
{
if (WARN_ON_ONCE(RPC_IS_QUEUED(task)))
return;
__rpc_do_sleep_on_priority(q, task, queue_priority);
}
static void __rpc_sleep_on_priority_timeout(struct rpc_wait_queue *q, static void __rpc_sleep_on_priority_timeout(struct rpc_wait_queue *q,
struct rpc_task *task, unsigned long timeout, struct rpc_task *task, unsigned long timeout,
unsigned char queue_priority) unsigned char queue_priority)
{ {
if (WARN_ON_ONCE(RPC_IS_QUEUED(task)))
return;
if (time_is_after_jiffies(timeout)) { if (time_is_after_jiffies(timeout)) {
__rpc_sleep_on_priority(q, task, queue_priority); __rpc_do_sleep_on_priority(q, task, queue_priority);
__rpc_add_timer(q, task, timeout); __rpc_add_timer(q, task, timeout);
} else } else
task->tk_status = -ETIMEDOUT; task->tk_status = -ETIMEDOUT;
......
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