diff options
author | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-09-08 06:15:35 +0300 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-09-30 22:35:14 +0300 |
commit | 5ce970393bad41499d50dfaea525ac8f01cdbc30 (patch) | |
tree | 6b9423daa5d1bfaddd9dbce63f2f5e1a14aa261e /net/sunrpc/sched.c | |
parent | 359c48c04af25397ecefec1ccf200ddd199617ce (diff) | |
download | linux-5ce970393bad41499d50dfaea525ac8f01cdbc30.tar.xz |
SUNRPC: Test whether the task is queued before grabbing the queue spinlocks
When asked to wake up an RPC task, it makes sense to test whether or not
the task is still queued.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'net/sunrpc/sched.c')
-rw-r--r-- | net/sunrpc/sched.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index dec01bd1b71c..9a8ec012b449 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -479,6 +479,8 @@ void rpc_wake_up_queued_task_on_wq(struct workqueue_struct *wq, struct rpc_wait_queue *queue, struct rpc_task *task) { + if (!RPC_IS_QUEUED(task)) + return; spin_lock_bh(&queue->lock); rpc_wake_up_task_on_wq_queue_locked(wq, queue, task); spin_unlock_bh(&queue->lock); @@ -489,6 +491,8 @@ void rpc_wake_up_queued_task_on_wq(struct workqueue_struct *wq, */ void rpc_wake_up_queued_task(struct rpc_wait_queue *queue, struct rpc_task *task) { + if (!RPC_IS_QUEUED(task)) + return; spin_lock_bh(&queue->lock); rpc_wake_up_task_queue_locked(queue, task); spin_unlock_bh(&queue->lock); |