提交 0ab24262 编写于 作者: T Trond Myklebust 提交者: Yang Yingliang

SUNRPC: Test whether the task is queued before grabbing the queue spinlocks

mainline inclusion
from mainline-4.20-rc1
commit 5ce97039
category: bugfix
bugzilla: 51820
CVE: NA

-------------------------------------------------

When asked to wake up an RPC task, it makes sense to test whether or not
the task is still queued.
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: NHuang Guobin <huangguobin4@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 5d268184
...@@ -474,6 +474,8 @@ void rpc_wake_up_queued_task_on_wq(struct workqueue_struct *wq, ...@@ -474,6 +474,8 @@ void rpc_wake_up_queued_task_on_wq(struct workqueue_struct *wq,
struct rpc_wait_queue *queue, struct rpc_wait_queue *queue,
struct rpc_task *task) struct rpc_task *task)
{ {
if (!RPC_IS_QUEUED(task))
return;
spin_lock_bh(&queue->lock); spin_lock_bh(&queue->lock);
rpc_wake_up_task_on_wq_queue_locked(wq, queue, task); rpc_wake_up_task_on_wq_queue_locked(wq, queue, task);
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
...@@ -484,6 +486,8 @@ void rpc_wake_up_queued_task_on_wq(struct workqueue_struct *wq, ...@@ -484,6 +486,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) 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); spin_lock_bh(&queue->lock);
rpc_wake_up_task_queue_locked(queue, task); rpc_wake_up_task_queue_locked(queue, task);
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册