Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2804201rdb; Wed, 4 Oct 2023 11:56:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEhdbuki8jZOEAsP2V/kj6ql0SRP3WUYR+GkFeGfx+DV5Ec71GHMMuRXn5+87Rm3Qf1R/1f X-Received: by 2002:a05:6808:ab7:b0:3ae:13fd:fa93 with SMTP id r23-20020a0568080ab700b003ae13fdfa93mr3154406oij.15.1696445764518; Wed, 04 Oct 2023 11:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696445764; cv=none; d=google.com; s=arc-20160816; b=mNS8GDS7qPu/RRUM1QazXu3oodpCKGRKG2ktH7uF9NPnK3nUmXwRJf/evTsqtlGcZ/ rv2qpbpQjfEj4KJiIvWqAdmfNZE3xcaVmAvqLpLvAQLbLB6cd2uaAtOqIIwGUx9ZQQfS MKhp28K3PTJiRsKwfnkicep0VRAKkne8s6ymfKXcs14BJwmWtn/tb5CvaXfVnyBkG6lV 0mRvCKXD7mRAPAGFF16PldTGZicn7dhKsTeAMGvk7EvU9UPx45OPByJk0lTQrrl17Xh8 +IWpVkQNRLSLpf4zukFuzBmTS4FtckkDc3Yz4Ltpy7H6i6XHoMf17wRrdkl3H1gz38yR cq8Q== 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=0KzDJRS7KxkkZ6Oh0+MnmsXHFeSbYVpjE5bfzb8MwZM=; fh=CNQ6vXJ3R5KRx/lfsiYDw2Juq638HhcPjPZ0txvelVM=; b=n8TXgqjJ+IETZKcwZwIbRkTJaqnQs+9ST7ZTbOfFrneQ9OfVv/AKNdn6m1Eh6u2WTo J00oz0J+2ioBr8Vja+BW/oDcIk+ocd9f8bq1NgxLBCB+rnI6LYeBHnpTJwmPFkumdAC3 w6dj5Hpd9Sogi1TE0baEajSssGyUvJIloLaTeIUM5j6+aPvos1HRwi167fkzh1ZDpDP+ F2h7EveS0ceNKaWAL2p9fPquxy88S1JDamTjhRsxfHW8lXK+o+wnpQhxs/wiTHdfUnAv NbzIyHALYQcNIvaH2kbKAFPypFHqkKX9RTVHCpXuzxY+yDG3f0mkQQleNMSxjMrOS96d jmXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=Ws4qCUkD; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id b26-20020a6567da000000b0055fd1bfb109si4182074pgs.679.2023.10.04.11.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 11:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=Ws4qCUkD; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id E903A83037EE; Wed, 4 Oct 2023 11:54:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244799AbjJDSyp (ORCPT + 99 others); Wed, 4 Oct 2023 14:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244618AbjJDSye (ORCPT ); Wed, 4 Oct 2023 14:54:34 -0400 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B2601B8 for ; Wed, 4 Oct 2023 11:53:58 -0700 (PDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2c29d23bee2so263661fa.0 for ; Wed, 04 Oct 2023 11:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; t=1696445636; x=1697050436; 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=0KzDJRS7KxkkZ6Oh0+MnmsXHFeSbYVpjE5bfzb8MwZM=; b=Ws4qCUkDzsKhsOn+heD62DOk+zU6uH2oy9wkshi+mlDUHsfnDtnXPlzXrojsH8zFlb dCf8QESSowRixpMsMkYTxDr8Nh9S+83WJDGy0/1MPG8girIF58TT0KnwtLnhM4flQ8Lf AESVHr4Cen7GR9fS51XrjldqKP6MBS0PDw0t4rwY1rv7A9mSIOOnMsD1gAW8yJb1r1ne ArByjJJ6JboBXCgWPhLHkpWFFn8TPwDn/svKvooMRki7k7w+69H2HFhfb7fHGcpJIyPZ 2Gpoc90EunM+8ncdocZtVw4SFjMAGJbKuYNMkNXqisOm0uY3C9GBgdcqZSKMXfr/0sL4 6l8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696445636; x=1697050436; 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=0KzDJRS7KxkkZ6Oh0+MnmsXHFeSbYVpjE5bfzb8MwZM=; b=eXJRBoQUVWGlIXfE4eA6sDLjuE1G6Qfxu+9JvCh/OjtbNIfmNzLrfu4CPBJAXix1S2 lOLLhJ4AVi5COwJqJOwWuSo0EcIypow1zXFqZj+PkArwUBCqJnIeVVWhfqCQZV3xmu08 OtZMhrznbnP7zUP5SLMWxaDdZ8fW/jIW8luKN9TBp2RP2P9K47YAMzXMoS73AtzvM1/Q /ND/zcKENozfqmiYbMR3N8jw7mhAn8Vf1SCzsj7lWNnZq7QvEb0q8aGJT6VXzZfd7Vqw ezK9YFMf//KbDpMnaJFahSnLrmCtUhhh1P8CKurZv3RhxuBO3yzf9/hUQcr7Wl6NTnbT 4fkg== X-Gm-Message-State: AOJu0YztzJfy0K0WRJm3QpKcCrxZ3rNsz9aCU9jppH+MCHxqjRuXmqIM ajXfdY1rkGyK3/VtxbhkHRrmDaTwx2pJ8UdsbnA2Geg1 X-Received: by 2002:a2e:b53a:0:b0:2bc:e36a:9e32 with SMTP id z26-20020a2eb53a000000b002bce36a9e32mr2723977ljm.5.1696445636362; Wed, 04 Oct 2023 11:53:56 -0700 (PDT) MIME-Version: 1.0 References: <93929ecf62e79670f1e3a1878757fc9fa443aa7c.1688210094.git.bcodding@redhat.com> In-Reply-To: <93929ecf62e79670f1e3a1878757fc9fa443aa7c.1688210094.git.bcodding@redhat.com> From: Olga Kornievskaia Date: Wed, 4 Oct 2023 14:53:44 -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 groat.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 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 11:54:52 -0700 (PDT) X-Spam-Level: ** 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 delegation > return") attempted to solve this problem by using nfs4's generic async er= ror > handling, but introduced a regression where v4.0 lock recovery would hang= . > The additional complexity introduced by overloading that error handling i= s > 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 c= an > race with another OPEN on client, but the open stateid has not yet be= en > updated. In this case, the client doesn't handle the OLD_STATEID err= or > 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.stat= eid)) > 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_sta= teid, > + lsp->ls_state)) > + goto out_restart; > + else if (nfs4_refresh_lock_old_stateid(&data->arg.lock_st= ateid, 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 >