Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp4267496pxb; Tue, 17 Nov 2020 16:25:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxTNi2cIHv9b7dgwXum2FJBxkQKS2ak9+LWuqxFPJR9sp/gLLWRIDA3fh5gdBaqQFCSo/A X-Received: by 2002:a17:906:79c4:: with SMTP id m4mr20962984ejo.26.1605659119107; Tue, 17 Nov 2020 16:25:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605659119; cv=none; d=google.com; s=arc-20160816; b=vmFiyYWjRI1F32U6S7DxmKvc71EjGdVFB91xoDj/W1smPfbp8SqmQK/2Wq6bWRZCYR lt2i1fKsLU5vgnk2DqptYJcyKGTMZsYj1MfVQK1JFkv4Wrj8ojh5jEl0cB6bG9H06tsd +r5xCwER6zyqHj5M3tLWjdSkuaj+qkJERG4hUHQx9zuopTUbbIEr9rkYbkcSMUabb7pP KTftzwnld6Rz5eqvpJs2KkgBH/TB5vMOqRmrub0CSgD2dC50UD6v0Pcvcj4jRu/uJaUf kZkJ2DWS+/EIA6lSoF+l+Kgsi3ywjEVYyg8kT/YZpak1+PwuY0PHsQz6Z50194YKhMP5 Mu8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=gFlZ38MwH8yQdiFbxPN+HVi8DqXGDlanSljdPiGUeDM=; b=AKTZKs96/L/OjSAKET7o+1i+r9lNMVjA7YsWkqumGlZ15Pe6DnmWkQ+C13kQIGUOLn cB+gwCXs8fKbeRH5GFrp9PKnVsj/nGp3YDQ7p4uQJbeUp9P3Q48YWKJelWkhq+HvKUw7 0hWIuvrTrdwBbamoHj7SVlrn72+Xp0Y1WVXKp6URW6syX6iC9pbRmsfEaEEkIkSYIc4T 92lO/Sq44TgGrkOLjhPf+e1CIfHjlVE2H7qp0Q/MQj5MQ4r1keNgluKnSLgG/k/rJ9Dn fLBSzidWOwpR7G5L22y9MMo+KB6uwisiD1j/9TzW7Ril/BK191GDQc8kdeGPgiPOe2eG 8h8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=ORMuFMU+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g18si14200321ejx.417.2020.11.17.16.24.42; Tue, 17 Nov 2020 16:25:19 -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=@amazon.com header.s=amazon201209 header.b=ORMuFMU+; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726406AbgKRAYk (ORCPT + 99 others); Tue, 17 Nov 2020 19:24:40 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:22958 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726182AbgKRAYj (ORCPT ); Tue, 17 Nov 2020 19:24:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1605659079; x=1637195079; h=date:from:to:cc:subject:message-id:mime-version; bh=gFlZ38MwH8yQdiFbxPN+HVi8DqXGDlanSljdPiGUeDM=; b=ORMuFMU+AatopXViHUN422do7kWLj/Z7Q2lEi1cOnvIypb5XFeDIkIPr 5j8QEOuMjcOCu2XbtjuYTGZL3eiYx1HJE9eJCF5kdRqFslT/HmxeJOeGU DsIpZpPT2MHn+C4VbNLeGBlfwAEL9Nes28IoWFUgLLDfK6ED+pDIfZnE6 M=; X-IronPort-AV: E=Sophos;i="5.77,486,1596499200"; d="scan'208";a="95133538" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2c-2225282c.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 18 Nov 2020 00:24:33 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2c-2225282c.us-west-2.amazon.com (Postfix) with ESMTPS id 1A887A220A; Wed, 18 Nov 2020 00:24:33 +0000 (UTC) Received: from EX13D07UWB003.ant.amazon.com (10.43.161.66) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Nov 2020 00:24:32 +0000 Received: from EX13MTAUEA001.ant.amazon.com (10.43.61.82) by EX13D07UWB003.ant.amazon.com (10.43.161.66) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 18 Nov 2020 00:24:32 +0000 Received: from dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (172.22.96.68) by mail-relay.amazon.com (10.43.61.243) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 18 Nov 2020 00:24:31 +0000 Received: by dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com (Postfix, from userid 4335130) id 7BE4440E2D; Wed, 18 Nov 2020 00:24:31 +0000 (UTC) Date: Wed, 18 Nov 2020 00:24:31 +0000 From: Anchal Agarwal To: Trond Myklebust , Anna Schumaker , , CC: Subject: [PATCH] NFS: Retry the CLOSE if the embedded GETATTR is rejected with ERR_STALE Message-ID: <20201118002431.GA6941@dev-dsk-anchalag-2a-9c2d1d96.us-west-2.amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If our CLOSE RPC call is rejected with an ERR_STALE error, then we should remove the GETATTR call from the compound RPC and retry. This could happen in a scenario where two clients tries to access the same file. One client opens the file and the other client removes the file while it's opened by first client. When the first client attempts to close the file the server returns ESTALE and the file ends up being leaked on the server. This depends on how nfs server is configured and is not reproducible if running against nfsd. Signed-off-by: Anchal Agarwal --- fs/nfs/nfs4proc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 9e0ca9b2b210..40e4259bc83e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3548,6 +3548,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data) res_stateid = &calldata->res.stateid; renew_lease(server, calldata->timestamp); break; + case -ESTALE: case -NFS4ERR_ACCESS: if (calldata->arg.bitmask != NULL) { calldata->arg.bitmask = NULL; -- 2.16.6