diff options
author | Zhang Xiaoxu <zhangxiaoxu5@huawei.com> | 2021-06-26 15:50:42 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-07-14 16:53:05 +0200 |
commit | f9c7f26879234395c43d103c191e2dc80ef468dd (patch) | |
tree | 62762d335ed34865e4d404317aa022a603348e09 /net | |
parent | d060386ffdbdee047898b39c48923ed09a133167 (diff) | |
download | linux-stable-f9c7f26879234395c43d103c191e2dc80ef468dd.tar.gz linux-stable-f9c7f26879234395c43d103c191e2dc80ef468dd.tar.bz2 linux-stable-f9c7f26879234395c43d103c191e2dc80ef468dd.zip |
SUNRPC: Should wake up the privileged task firstly.
commit 5483b904bf336948826594610af4c9bbb0d9e3aa upstream.
When find a task from wait queue to wake up, a non-privileged task may
be found out, rather than the privileged. This maybe lead a deadlock
same as commit dfe1fe75e00e ("NFSv4: Fix deadlock between nfs4_evict_inode()
and nfs4_opendata_get_inode()"):
Privileged delegreturn task is queued to privileged list because all
the slots are assigned. If there has no enough slot to wake up the
non-privileged batch tasks(session less than 8 slot), then the privileged
delegreturn task maybe lost waked up because the found out task can't
get slot since the session is on draining.
So we should treate the privileged task as the emergency task, and
execute it as for as we can.
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: 5fcdfacc01f3 ("NFSv4: Return delegations synchronously in evict_inode")
Cc: stable@vger.kernel.org
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/sched.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index b8be7660b29a..8fc4a6b3422f 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -614,6 +614,15 @@ static struct rpc_task *__rpc_find_next_queued_priority(struct rpc_wait_queue *q struct rpc_task *task; /* + * Service the privileged queue. + */ + q = &queue->tasks[RPC_NR_PRIORITY - 1]; + if (queue->maxpriority > RPC_PRIORITY_PRIVILEGED && !list_empty(q)) { + task = list_first_entry(q, struct rpc_task, u.tk_wait.list); + goto out; + } + + /* * Service a batch of tasks from a single owner. */ q = &queue->tasks[queue->priority]; |