Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3421391pxx; Mon, 2 Nov 2020 08:26:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxabMxZhcci5Eu+zBqg8v8DBFOMdHujUHEHzf0sDIpE2J+UPu8RacLfNYfWKIIrnAvvxtKh X-Received: by 2002:a05:6402:143:: with SMTP id s3mr16660135edu.267.1604334369356; Mon, 02 Nov 2020 08:26:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604334369; cv=none; d=google.com; s=arc-20160816; b=Kqhrtt9XJqAI5QAV+ur9wivr1y4UK8fkbG58O/yVJF860wnnqRtO2GmXiqmVB2dQyn EP1xKZDGPZKUaZCxvDZz7WNBZlWD9jpn9wovHk7T2q/7jgK96/qserW7uPh2NGQFA6x2 OLY1fM1YsOIDauPu7dmToQpMyWXjnCLGVVOnvzxQxR+edw/0PnA78wUpyI5yufAOUvbt ekqnW9jj/67rmaVsapK3Q+wTpIuqe6toLCUEvuR7Vfm3TZBgCF8cmxy6C9PY+QrOXun3 p+HsFlkUgHfl5hnswmYCZOYmTekpxp4up89Jgwnj40lmFaop0hkno8PvE9yU0KrScrtO rbvA== 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=b/OZ8HTZ7OhKXvD7+u0886Hzbgg8nYkTvZEoAZO/9hE=; b=Ewjk0+GFArdyl/R81Sxht7XCfqSlbFjeGnw1N6lCYpqiISv+IbhwWrggT5NkhoB49/ jY6YaphtG9r350pQ7SYPd6KaZj4HbSwoYVclhOr7nOVDs2J09Rc/urHLCvUjajL/w/68 mXv6y1Qu5nTUjLZazI5kIYvFWzmZF0UlNsdTrO3F56Kb5u83HPHtiDc1v383Ml526sXR ISkakgoKFtCtU02xvKfqWnJ1rX2zLaQp3OUn9yjK0d/AQcdCv/py4m0DojCAQYEGPtE4 g6UBe9ji+YoZ2MdEJu4V47UsFygxjrqxmQ9/xCHHx4kP8BbCMjMYig+oRDvEJJKI56aD opHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Th9lyTDK; 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 p3si10775749eja.565.2020.11.02.08.25.46; Mon, 02 Nov 2020 08:26:09 -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=Th9lyTDK; 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 S1726834AbgKBQY7 (ORCPT + 99 others); Mon, 2 Nov 2020 11:24:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727057AbgKBQYz (ORCPT ); Mon, 2 Nov 2020 11:24:55 -0500 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B2A2C0617A6; Mon, 2 Nov 2020 08:24:55 -0800 (PST) Received: by mail-pf1-x443.google.com with SMTP id o129so11548524pfb.1; Mon, 02 Nov 2020 08:24:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=b/OZ8HTZ7OhKXvD7+u0886Hzbgg8nYkTvZEoAZO/9hE=; b=Th9lyTDK1FnMIa6sXygE30/GZFlqBziQAnhCPoDJ7wZv0q1G7Flj0yTRhY2NuxExgM v93a3jhDELYrN++eD55Vi5VTvQv/XEFFVcBxUXjLS4fn1Fari4vygY0crRqECJK+eTmy akLWU/Y77lSfXqbwTSqpDDzXw9BU5RIPUpeIqI4jCQ/IC6oUSaZ4fxfMdPraj4Ex/Lh4 fJ8MX2COPRWVYgv3iwQCcTGj/Ay4iP+n9WYKWEOjomdz2f9ZOYD6EpudJJBIHZHv0RtY gZFCxv902bmM35r+fEL5z3PE5gUDy62IkBlHFCLZRN752sOtuSZDOQtVVpedQyO3/at3 OR3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=b/OZ8HTZ7OhKXvD7+u0886Hzbgg8nYkTvZEoAZO/9hE=; b=odgVu8XjLc3kdDRW+Ayssqv5Dk+4SXfgk3o6qIWGs7mPIWXfikvqbbjd0ng1W70wVT yHJll3M+FK3Lxwr0pj7acWb58tK/yvGzsqlQdS42KfOCqWHVjn2NIoqZALkIT8++sYJO BGJHfWSDV4+8R3V7f13nOfMGqdhntgzs5jYhp1G4cTCtIM3uKnJTaWkPMJfooA5P1YJn sqj7b2CES7CpwJZfF2tngdif4tY9Y8AyykhHw3H/4X+1vMqlst4e/Lj3qWbz5VhI9sLF vaH5dKzqwJLo1UY4wp1bvQXIzxHJBMcSBQ8l3RUKKStWy6LPOLTqk1BAHKIZO+0Q3pIc iQlw== X-Gm-Message-State: AOAM530DE7Wea2twKhvAayoJtomdepSDZjjP1e77Z9KKnLnIRpli7hBL WIW+GSnCBpzGDfJX6TyBRyM= X-Received: by 2002:a17:90a:588d:: with SMTP id j13mr17600158pji.236.1604334294719; Mon, 02 Nov 2020 08:24:54 -0800 (PST) Received: from opensuse.lan (173.28.92.34.bc.googleusercontent.com. [34.92.28.173]) by smtp.googlemail.com with ESMTPSA id b29sm8379575pff.194.2020.11.02.08.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 08:24:54 -0800 (PST) From: Wenle Chen X-Google-Original-From: Wenle Chen To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, chenwenle@huawei.com, solachenclever@hotmail.com, nixiaoming@huawei.com, solachenclever@gmail.com Subject: [PATCH 2/2] NFS: Limit the number of retries Date: Tue, 3 Nov 2020 00:24:38 +0800 Message-Id: <20201102162438.14034-3-chenwenle@huawei.com> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201102162438.14034-1-chenwenle@huawei.com> References: <20201102162438.14034-1-chenwenle@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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); } -- 2.29.1