Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2808304rdb; Wed, 4 Oct 2023 12:02:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHR0WGkHNi/ZZf0IGpBxPXhUWgYiQIF4W+ftSfvrybCZ5/aEgX5ZmwOzCciG3QEQ2jv2eP7 X-Received: by 2002:a17:902:d50f:b0:1c3:bc2a:f6b4 with SMTP id b15-20020a170902d50f00b001c3bc2af6b4mr3833648plg.42.1696446168612; Wed, 04 Oct 2023 12:02:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696446168; cv=none; d=google.com; s=arc-20160816; b=aEZtMlWj6Be8g414EoTprgzhnh43yFH/TwX5HPGLPUVAW9BouHjPD5EvgTAvsF6mmk mUDK4HhDU6fXqyfkTWfeKV59XoOSuMMEo6VrpXHVehEwDs+9lrt5A6yNF7SDP/RYhRbg g9o0+lWvYhGNx6HUO05FvzFUSb5rp/evXgM7Vsb3kadoO93jnDFwdg1icnqv+kEUL6MG vKDKY8CLG/QfcHLsbb6kqAwN+MFamKEtsPxHH+sy5J8hUDZbzSVpZaKKS9oJ8mXzrcuq FcK+Hv+C57YiF2wVP9xROVJsemMLbQX3CG1aGWmzJux6ZS00y3y0BP2wQnvEwkC5ebp/ NGug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=DyevCSMwXTkHu2xCoyw6JERTPCCU/m7U9T7AqkwuS1c=; fh=CNQ6vXJ3R5KRx/lfsiYDw2Juq638HhcPjPZ0txvelVM=; b=m3Jz1SL3ka3JSnXho0L/K/9AF5Ly9kkDPQmB4f8FxWq2/RdXYid88bWv9uRa/7f+84 m2PMMtzj3KGhHcBaSRvHF6JDkEM8emo1Vvwe2w8KqtqD2JSDQ1hQ2i3fDV6EEx4q6tWT K/R7XQhxnHHna5j3ZB2FOOiHxse+xTNHvY57pcPTI4xKIEjjDw5oB3R5t5eVIparnc1I DcoD/nayrx73+7K/xbOJv5Mx6tG55KRmzo+6x85si+3RLulBWRodpK3Aqb5D/gx5l4pE nKTYBa5DHpS79g+E+xqWytrBUffvHKugkLravFkrLR3i3xkQann1OVjgVv+FpwZEq1op x1qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=FU9O3nqT; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id lc6-20020a170902fa8600b001c724f997ffsi4159299plb.131.2023.10.04.12.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 12:02:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=FU9O3nqT; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id C2942809D1D1; Wed, 4 Oct 2023 12:02:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245193AbjJDS7P (ORCPT + 99 others); Wed, 4 Oct 2023 14:59:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245198AbjJDS5d (ORCPT ); Wed, 4 Oct 2023 14:57:33 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 157FE19B0 for ; Wed, 4 Oct 2023 11:55:04 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2c18b0569b6so461351fa.1 for ; Wed, 04 Oct 2023 11:55:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; t=1696445702; x=1697050502; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DyevCSMwXTkHu2xCoyw6JERTPCCU/m7U9T7AqkwuS1c=; b=FU9O3nqT4+bDcIsThQpphagDq1UjNljz9OQEIm0lEjhnNzNsxk41chllDop1E25xUs E+c6pKxrTLyM+DcZjEZF1SQ2nmvHh0f/DOgh8ItZCYnyCDrGSbmA+IVlB1y+IRKgdsIh bY7OsMHnPU7R/JaQaBVu+cdII3qGRzGS6xAXpbCmhEShWXzKcoo/M4d3nPsAXB/r9azv ItHGmuYK8xUaYzUW37CYv2YUpOiWu6Oh+XjE6ESszW0TPTV6H3QuT/2guM/IVvcSPJxm hqQFs9rnRnkKskr8D6MPekpZfChd1/UsEdcbhcy0uOsOAbMmeaG8rM6pLSAfwl+FtVPA yyMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696445702; x=1697050502; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DyevCSMwXTkHu2xCoyw6JERTPCCU/m7U9T7AqkwuS1c=; b=qtqvntYFIowCKGhFrztpw9Wz1NfC70h3Sj8EAKhjVBU/uWBSb/qhw2PA7dsC7eWsCH +2upYDahkDZW62ZvFU/UmIdtLJH11KTXYF2nTbMDH8NGyLN/eNJrhEteFU35MBzOriiR M5XjOnTtQEydgryKOVe7wYdxzkN1i0efZ2LNZRDPvNDfxPtfU0HxVNFYgigDN/zuMv8h Q/tTqgjJnrRPF11WKzShqL6Zp6pe2kLW8wU1JPHw7n85BmSFuwWwcoiQTrgWYuBRiOqm 906LOrW7rieWpdK72AeqpH9+JBFccEQjzeGEvmcaWIMFaTuX15H2GJk5/xt1Tg0gT2He qcOQ== X-Gm-Message-State: AOJu0YwHbLd/lr9Od6lStFKhq81MCwsdkwr3FYR5wMtBSLZfAfN4BoAO HoyWVBGh9+50FAKJwxDNCD/U0DcRozjmAqoVHsihAKey X-Received: by 2002:a2e:bea1:0:b0:2bf:7908:ae7c with SMTP id a33-20020a2ebea1000000b002bf7908ae7cmr2917251ljr.2.1696445701824; Wed, 04 Oct 2023 11:55:01 -0700 (PDT) MIME-Version: 1.0 References: <93929ecf62e79670f1e3a1878757fc9fa443aa7c.1688210094.git.bcodding@redhat.com> In-Reply-To: From: Olga Kornievskaia Date: Wed, 4 Oct 2023 14:54:50 -0400 Message-ID: Subject: Re: [PATCH v3] NFSv4: Fix dropped lock for racing OPEN and delegation return To: Benjamin Coddington Cc: trond.myklebust@hammerspace.com, anna@kernel.org, Olga.Kornievskaia@netapp.com, linux-nfs@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 04 Oct 2023 12:02:07 -0700 (PDT) X-Spam-Level: ** Sorry, I didn't mean this patch. I meant the revert patch. On Wed, Oct 4, 2023 at 2:53=E2=80=AFPM Olga Kornievskaia w= rote: > > Hi Trond/Ben, > > Did this ever go to stable? I don't know if I missed a mail from Greg > that it was picked up or it never got picked up because it wasn't > marked for stable? > > Thank you. > > On Sat, Jul 1, 2023 at 8:13=E2=80=AFAM Benjamin Coddington wrote: > > > > Commmit f5ea16137a3f ("NFSv4: Retry LOCK on OLD_STATEID during delegati= on > > return") attempted to solve this problem by using nfs4's generic async = error > > handling, but introduced a regression where v4.0 lock recovery would ha= ng. > > The additional complexity introduced by overloading that error handling= is > > not necessary for this case. This patch expects that commit to be > > reverted. > > > > The problem as originally explained in the above commit is: > > > > There's a small window where a LOCK sent during a delegation return= can > > race with another OPEN on client, but the open stateid has not yet = been > > updated. In this case, the client doesn't handle the OLD_STATEID e= rror > > from the server and will lose this lock, emitting: > > "NFS: nfs4_handle_delegation_recall_error: unhandled error -10024". > > > > Fix this by using the old_stateid refresh helpers if the server replies > > with OLD_STATEID. > > > > Suggested-by: Trond Myklebust > > Signed-off-by: Benjamin Coddington > > --- > > fs/nfs/nfs4proc.c | 9 ++++++++- > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c > > index 6bb14f6cfbc0..f350f41e1967 100644 > > --- a/fs/nfs/nfs4proc.c > > +++ b/fs/nfs/nfs4proc.c > > @@ -7180,8 +7180,15 @@ static void nfs4_lock_done(struct rpc_task *task= , void *calldata) > > } else if (!nfs4_update_lock_stateid(lsp, &data->res.st= ateid)) > > goto out_restart; > > break; > > - case -NFS4ERR_BAD_STATEID: > > case -NFS4ERR_OLD_STATEID: > > + if (data->arg.new_lock_owner !=3D 0 && > > + nfs4_refresh_open_old_stateid(&data->arg.open_s= tateid, > > + lsp->ls_state)) > > + goto out_restart; > > + else if (nfs4_refresh_lock_old_stateid(&data->arg.lock_= stateid, lsp)) > > + goto out_restart; > > + fallthrough; > > + case -NFS4ERR_BAD_STATEID: > > case -NFS4ERR_STALE_STATEID: > > case -NFS4ERR_EXPIRED: > > if (data->arg.new_lock_owner !=3D 0) { > > -- > > 2.40.1 > >