Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3679212pxj; Tue, 1 Jun 2021 10:38:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaLJoMP7oOA9NRjzR+rJF3WkXIL09O0aa3Mvy+pkb7lHHtPo9WrUSXR9fmpGqgRQTVf+nI X-Received: by 2002:aa7:d28a:: with SMTP id w10mr4808172edq.23.1622569107994; Tue, 01 Jun 2021 10:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622569107; cv=none; d=google.com; s=arc-20160816; b=dkm/lhzWANcMk0CXBKZI6u43elmpKIZ8J78saE3VZ5roLuvh3IlKncU9s+75hP6Lce UwMfboSndhFUkR43qLqARvAf4v1h8D7RvUPkxN+oUKqU2ohJsMwqCRVELLz0qVMa71Wp muzV+tqR/yECG4h9TLBjJ8QUGHJ5/XwEEWZsUtN2RP7ob5793wAKK1MN7vC8F//7EA2x PgCiSiJmgrdS9qXPmTi/fURQ+vdVsIexUAhSMF7FAcQgZ6WSM0ApMWHxtgoU8YOJdPWc ytyZU2pGSx5qJ/9NlUh1796ZzrEICZy6Ec/GunEZzxyl+q0qpEis7A7eBl0ff0Dd06Q7 63kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/3kZVODZgehyms7NKqvlFVpDYmOiW0KGyFT7BNj/eQ8=; b=dQtrdUava2UXIrtFEc/sy7+ebX4U7DG6XunoamTlGzOxAZ7Y506BTU36SSza6+lXAQ 6L8Wk5xqyoUU9GNGkcizxtki/VdNwlMDtypDSMkPAYMXaKcNUjAbmNE03eftn4XnvKTo RbXs4CkB0okZqT84xumxVi4BZyUK8N1Fkw7WHh+z/CJ1CtFcgaibuX9/na732qp+gK0U EZgbv4IHESED6KU41m7W4kayIjoWOWUW0xJKWXyldzIGuE4sn2o5wCuduUa0vQvSzJFN k2FnTC9MWtSaghXZlj9s92jVkQ6nBwljxzJvRolj5H9NrhnWTVuNsIiMfA0ZyiV5Wby1 BmkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mb4YiNPO; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co10si20855edb.509.2021.06.01.10.38.04; Tue, 01 Jun 2021 10:38:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Mb4YiNPO; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234294AbhFARiV (ORCPT + 99 others); Tue, 1 Jun 2021 13:38:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:60188 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233853AbhFARiV (ORCPT ); Tue, 1 Jun 2021 13:38:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D8C0561042; Tue, 1 Jun 2021 17:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622568999; bh=GQc7mBd8skDb3dWoegKN2kqwZcPfuvWq76TTPL1/cfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mb4YiNPOH1IBSgioImxzu2vrRYuJHlh0ZXuB3I5UxnKIM217/G2Tc7aBNPACxx/h7 IvB9NeO40/k1P649Gt5Pq+xLE5AESn//VFsmCtNTsnQhVxJui+NqLUApYfVNEjI7uW 9EXo5R64J9FG+LUv1ZtOdIS8zhBpIDvSmUOT11ZeZ8E/no0d23lYl/fFA15zhb4sH4 2OxEtZvw8pcpfqMgOeJ07L809nD/OBQ7tv1fk+e+HT5FH1nvRJMjDyClTwJ8/kBVSK ztq5leppAINpjQCL2IvxoPwNcGBmwxBte8qxm8qGk0eMK95DoiI9eB5QOMhr4sGt5C LkkgQsTeptLWg== From: trondmy@kernel.org To: zhangxiaoxu Cc: linux-nfs@vger.kernel.org Subject: [PATCH 2/2] NFSv4: Fix second deadlock in nfs4_evict_inode() Date: Tue, 1 Jun 2021 13:36:34 -0400 Message-Id: <20210601173634.243152-2-trondmy@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210601173634.243152-1-trondmy@kernel.org> References: <20210601173634.243152-1-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust 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 --- fs/nfs/nfs4proc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 673809644981..e25c16257545 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -9658,15 +9658,20 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) &task_setup_data.rpc_client, &msg); dprintk("--> %s\n", __func__); + lrp->inode = nfs_igrab_and_active(lrp->args.inode); if (!sync) { - lrp->inode = nfs_igrab_and_active(lrp->args.inode); if (!lrp->inode) { nfs4_layoutreturn_release(lrp); return -EAGAIN; } 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); if (IS_ERR(task)) return PTR_ERR(task); -- 2.31.1