Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3837368pxj; Mon, 7 Jun 2021 23:10:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq/yr3H9LZF1+gcG55wrnplzb/sAzvswCwp3xP2nEZ8pQXYIcEgiy9sjCTvyrqLh9mF8aJ X-Received: by 2002:a17:906:a458:: with SMTP id cb24mr21755864ejb.482.1623132625222; Mon, 07 Jun 2021 23:10:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623132625; cv=none; d=google.com; s=arc-20160816; b=LMH+wEXBgJxnP759M70RzUqekd+y9D49k1EnnNBh2kSAHt7+Z1qjdhQ82FL0r2E472 xPwXOh2WlIoM1WREmlgLLZvyHIZsKVEXMh0ixFapnUk6eLKiyFTkMjuhzBBKtjfe/0Rv podQn7pt4i5632ymswHMi+LI3GSM6Ss+JEQ25pwvnO+hv4GEffhsrLPahzbHyDmpueZQ ijTz3wzXylm7FXfTPc+gnVpyLs3NUQl71XUamBeRj1wIQroZcxATbH4uIFrSqtxl1lph DyNFvRiBin5smEAa8nNzs8dtp0AGwaaE+4xwb9Mqeh3LnlNWPl9cuDjAyZehRgem8x+x iSnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=nYIcCcIPWNPzFgbSwjZ1KPaCA9jv5gNtYlmUtruleWg=; b=IECKEjiS/Mib0x9h6v0IB8Ew1vGAIHfmnNl/HnB++eKEAmvxfR95q+T84dFJUYrgEu f3J+avdFg1zNgDyzFxRZUeuhLUBQcEMjkA1vW2l9k2A/efEldfFe70Ixw7NcAHZUXvWB txrXk+QMJeNnt48RoSez22Yuais0Y/bxCY2OtARIKJjGH4CU7zoJ4NHs34M1oCtxbuiQ /AzgPtPtK+UkXEH60qy7Hyl1owJUaAz1KTrwMH82u9g+D0aWzQShZndsvc0YHUnrb2hb WAo5PaPOMpVK+0KduX/L0NJZbbKWIdLirtlchlrIbxPhD1A3v7xUwslLI4QYU93h+XFP hXBQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s24si5984290ejs.346.2021.06.07.23.09.51; Mon, 07 Jun 2021 23:10:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230307AbhFHGLC (ORCPT + 99 others); Tue, 8 Jun 2021 02:11:02 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:4506 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbhFHGLB (ORCPT ); Tue, 8 Jun 2021 02:11:01 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FzfrB2PkdzZdwk; Tue, 8 Jun 2021 14:06:18 +0800 (CST) Received: from dggpeml500023.china.huawei.com (7.185.36.114) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 8 Jun 2021 14:08:38 +0800 Received: from [10.174.176.83] (10.174.176.83) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 8 Jun 2021 14:08:37 +0800 Subject: Re: [PATCH 1/2] NFSv4: Fix deadlock between nfs4_evict_inode() and nfs4_opendata_get_inode() To: Trond Myklebust , "trondmy@kernel.org" CC: "linux-nfs@vger.kernel.org" References: <20210601173634.243152-1-trondmy@kernel.org> <49396167-ff9c-9363-ded7-732d14d60a8e@huawei.com> From: "zhangxiaoxu (A)" Message-ID: <49605ca6-ef2c-4fa3-165e-d9a467e05433@huawei.com> Date: Tue, 8 Jun 2021 14:08:37 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.83] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500023.china.huawei.com (7.185.36.114) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 在 2021/6/7 21:51, Trond Myklebust 写道: >> 在 2021/6/2 1:36,trondmy@kernel.org  写道: >>> From: Trond Myklebust >>> >>> If the inode is being evicted, but has to return a delegation >>> first, >>> then it can cause a deadlock in the corner case where the server >>> reboots >>> before the delegreturn completes, but while the call to >>> iget5_locked() in >>> nfs4_opendata_get_inode() is waiting for the inode free to >>> complete. >>> Since the open call still holds a session slot, the reboot recovery >>> cannot proceed. >>> >>> In order to break the logjam, we can turn the delegation return >>> into a >>> privileged operation for the case where we're evicting the inode. >>> We >>> know that in that case, there can be no other state recovery >>> operation >>> that conflicts. >>> >> it's looks good to me. >> >> but i have another confuse, how to ensure no writeback when evict nfs >> inode? >> because flush writes to server when close? >> but not all close will flush writes to server. > The struct nfs_open_context holds a reference to the dentry (which > holds a reference to the inode) and to the superblock. The struct > nfs_page that is tracking page dirtiness then holds a reference to the > nfs_open_context. > > That mechanism ensures the inode cannot be evicted until all dirty > pages have been either flushed or cancelled. The only thing we need to > worry about is the delegation and the pNFS layout since neither one is > allowed to reference the inode in any way (because otherwise they would > prevent the memory reclaim mechanisms from working). > Yes, it is. Thank you very much.