提交 9da1d03a 编写于 作者: T Trond Myklebust 提交者: Wang ShaoBo

NFSv4: Fix second deadlock in nfs4_evict_inode()

stable inclusion
from stable-v5.10.44
commit d973bd0d6e7f9b4ea976cc619e8d6e0d235b9056
bugzilla: https://bugzilla.openeuler.org/show_bug.cgi?id=462
CVE: NA

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

commit c3aba897 upstream.

If the inode is being evicted but has to return a layout first, then
that too can cause a deadlock in the corner case where the server
reboots.
Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NHang <haihangyiyuan@163.com>
Reviewed-by: Jian Cheng <cj.chengjian(a)huawei.com>
Signed-off-by: NWang ShaoBo <bobo.shaobowang@huawei.com>
上级 0a518333
...@@ -9619,15 +9619,20 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) ...@@ -9619,15 +9619,20 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync)
&task_setup_data.rpc_client, &msg); &task_setup_data.rpc_client, &msg);
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
lrp->inode = nfs_igrab_and_active(lrp->args.inode);
if (!sync) { if (!sync) {
lrp->inode = nfs_igrab_and_active(lrp->args.inode);
if (!lrp->inode) { if (!lrp->inode) {
nfs4_layoutreturn_release(lrp); nfs4_layoutreturn_release(lrp);
return -EAGAIN; return -EAGAIN;
} }
task_setup_data.flags |= RPC_TASK_ASYNC; task_setup_data.flags |= RPC_TASK_ASYNC;
} }
nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 0); if (!lrp->inode)
nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1,
1);
else
nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1,
0);
task = rpc_run_task(&task_setup_data); task = rpc_run_task(&task_setup_data);
if (IS_ERR(task)) if (IS_ERR(task))
return PTR_ERR(task); return PTR_ERR(task);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册