Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1231730pxb; Wed, 4 Nov 2020 03:36:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJxo+n1n5xmiq7S0Nf8+4NchOtwNt/S+T+td2qYnd28PFyIgZc/fmiJ0WrReYJU9HIPcAyQP X-Received: by 2002:a50:99c3:: with SMTP id n3mr26758035edb.213.1604489814261; Wed, 04 Nov 2020 03:36:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604489814; cv=none; d=google.com; s=arc-20160816; b=QqdE6MaTDFk4kgiCN2W1n4W+iPBoC0uu2HHMNpo4IAnwRuHDFJvzb3ksvTiXWQE1Kj yhlCdKxQWriM1ahuPv1y00Z2N0aD21v2ErtVT2lFdYIknaErQiZPI6tY7V7Njt0oYb5M iAjiljLrj4Imnk8/Lo2XQLknVuyuAtQTx+Uj6D7sDhiRKasQSrZCHLJXjs1NrP862tHu 8bj69vViAcP0p163IvqSkWZV7qvh2+xOeMfb6pkpclNfixp8YfQopxFLodhAEwTP9cZf ZaTAbT1+BnYfLRz+1UjUUdYLRJnDaSCMgutdxP9Sqvtdup1hHJAL3T0UpEQl+YFD/gvX ALeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=sHxsYW7dtDokTqOCqyvEtWMH1g82kxcGZGcMhLeJhSU=; b=BxVIfOhnOHYHEzzBSoFelPmK3c/TPDaghHaNDrX/Uf5+RyW7bzhLbBk5gv/5T7oGsP r4+IxwSjVTcgLM5a+p62xM4IhfeYm/QGV2eVuNykLbRjPaXlIFhMXhnwkJD1tRvbil2j o8xCiuSpMfEMOOj3RxnRpFqkdZSFxyhAh80W+eJstpT2+NmHc9OCfi1dwrJuZixq6wKA k6R1Rk6WQ5oE9DmTIql45Zj1HAvpmZ1ARzQffANTr2lwQ9jbGrbeZ7a9JJd2SIdrFcqo Ho2ZZkI7tlXeddM95UHtUItM4QcWmItUiM6PswpsDCrJUrgy8RAA2hZcyBVzzIO97Rl3 vjzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oYuqdfNi; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i11si1137584eje.415.2020.11.04.03.36.16; Wed, 04 Nov 2020 03:36:54 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=oYuqdfNi; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728841AbgKDLdw (ORCPT + 99 others); Wed, 4 Nov 2020 06:33:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728700AbgKDLdv (ORCPT ); Wed, 4 Nov 2020 06:33:51 -0500 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0E9C0613D3; Wed, 4 Nov 2020 03:33:51 -0800 (PST) Received: by mail-pg1-x543.google.com with SMTP id r10so16354705pgb.10; Wed, 04 Nov 2020 03:33:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=sHxsYW7dtDokTqOCqyvEtWMH1g82kxcGZGcMhLeJhSU=; b=oYuqdfNizbvNgx8VPH1L01MrjPlZsZtJxceSbmq7LYgdG1+2iy9po61wNSyJPKRdbs 2f3sRPHfbyd4Z4T38rGVUg7ZPz3ec8vTVQeFnevtT54eh4dL7JrtSTM8erjbNMyCIPt0 PBTrkwCMbI+hl0tm5Q08GOW2wzsG/SWy+3g2Y4wV1NBUO4+xyK86oXRyTI4KikVdP67g aQNHqMmxvJDNaWQZYrlm9IIxVpdcUSxyjT2+/vkszZMwc+6MtvaJOiznu1Lg3xgbxe2w 0CWmhOJeQjVMYUUQ7FbWmkoUUPf+16AyezGz2wRMrLf7AU0woCZv5JE8qB4reNbm2OS0 gDgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=sHxsYW7dtDokTqOCqyvEtWMH1g82kxcGZGcMhLeJhSU=; b=ZPPfjW9baMO9Jvw5vo2vXR3OoX6LWLAjxiHyGwX33Go5Th1/nsnng2O7Ja/8EY9sdV BiR5TwHZk6m0P/dDT78Jzc8GD7lOQGhqphiST9C5404ojfY0bBQaGgHGKPFQ6MnaK26L cvSJP5WgS0Y6iTUJ76CgJwdJdGPslDU9t48ORHlBTU8ehdMkCjjcbqQyAnbdBvKuuvE4 V2nskTPwl47BwVPZdqcTZ5PW/qZusFmOZmV5AQ1ect5kST+z+ussaB3YU92pK21XclYg h4cpZSwPeyykpekeuG6R+MJgvLDTKqdysIEYnZ49hRdLxfnoeSI7AJNr0hKEF1ytze7a qrNQ== X-Gm-Message-State: AOAM531H2DsJ46qg0tcKTGj2dkMumwhVcfLpTQAwfNJ3akUuWYW2hDDR MiNmkGvjKWWaYC5OgJspmvk= X-Received: by 2002:a62:7e14:0:b029:18a:d515:dc47 with SMTP id z20-20020a627e140000b029018ad515dc47mr16809540pfc.78.1604489631399; Wed, 04 Nov 2020 03:33:51 -0800 (PST) Received: from soladeMBP.lan (173.28.92.34.bc.googleusercontent.com. [34.92.28.173]) by smtp.gmail.com with ESMTPSA id h20sm2061216pgv.23.2020.11.04.03.33.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 03:33:50 -0800 (PST) Subject: Re: [PATCH 2/2] NFS: Limit the number of retries To: Trond Myklebust , "anna.schumaker@netapp.com" Cc: "chenwenle@huawei.com" , "linux-nfs@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "nixiaoming@huawei.com" References: <20201102162438.14034-1-chenwenle@huawei.com> <20201102162438.14034-3-chenwenle@huawei.com> <8db50c039cb8b8325bb428c60ff005b899654fb4.camel@hammerspace.com> From: Wenle Chen Message-ID: Date: Wed, 4 Nov 2020 19:33:48 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <8db50c039cb8b8325bb428c60ff005b899654fb4.camel@hammerspace.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Trond Myklebust 於 2020/11/3 上午1:45 寫道: > On Tue, 2020-11-03 at 00:24 +0800, Wenle Chen wrote: >>   We can't wait forever, even if the state >> is always delayed. >> >> Signed-off-by: Wenle Chen >> --- >>  fs/nfs/nfs4proc.c | 4 +++- >>  1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c >> index f6b5dc792b33..bb2316bf13f6 100644 >> --- a/fs/nfs/nfs4proc.c >> +++ b/fs/nfs/nfs4proc.c >> @@ -7390,15 +7390,17 @@ int nfs4_lock_delegation_recall(struct >> file_lock *fl, struct nfs4_state *state, >>  { >>         struct nfs_server *server = NFS_SERVER(state->inode); >>         int err; >> +       int retry = 3; >> >>         err = nfs4_set_lock_state(state, fl); >>         if (err != 0) >>                 return err; >>         do { >>                 err = _nfs4_do_setlk(state, F_SETLK, fl, >> NFS_LOCK_NEW); >> -               if (err != -NFS4ERR_DELAY) >> +               if (err != -NFS4ERR_DELAY || retry == 0) >>                         break; >>                 ssleep(1); >> +               --retry; >>         } while (1); >>         return nfs4_handle_delegation_recall_error(server, state, >> stateid, fl, err); >>  } > > This patch will just cause the locks to be silently lost, no? > This loop was introduced in commit 3d7a9520f0c3e to simplify the delay retry loop. Before this, the function nfs4_lock_delegation_recall would return a -EAGAIN to do a whole retry loop. When we retried three times and waited three seconds, it was still in delay. I think we can get a whole loop and check the other points if it was changed or not. It is just a proposal.