Skip to content

Commit c3aba89

Browse files
author
Trond Myklebust
committed
NFSv4: Fix second deadlock in nfs4_evict_inode()
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: Trond Myklebust <[email protected]>
1 parent dfe1fe7 commit c3aba89

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fs/nfs/nfs4proc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9658,15 +9658,20 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync)
96589658
&task_setup_data.rpc_client, &msg);
96599659

96609660
dprintk("--> %s\n", __func__);
9661+
lrp->inode = nfs_igrab_and_active(lrp->args.inode);
96619662
if (!sync) {
9662-
lrp->inode = nfs_igrab_and_active(lrp->args.inode);
96639663
if (!lrp->inode) {
96649664
nfs4_layoutreturn_release(lrp);
96659665
return -EAGAIN;
96669666
}
96679667
task_setup_data.flags |= RPC_TASK_ASYNC;
96689668
}
9669-
nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1, 0);
9669+
if (!lrp->inode)
9670+
nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1,
9671+
1);
9672+
else
9673+
nfs4_init_sequence(&lrp->args.seq_args, &lrp->res.seq_res, 1,
9674+
0);
96709675
task = rpc_run_task(&task_setup_data);
96719676
if (IS_ERR(task))
96729677
return PTR_ERR(task);

0 commit comments

Comments
 (0)