Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5467441rwn; Mon, 12 Sep 2022 09:26:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR55bXjpc7PrhHgQBboNAY/lNqd55Cx7nWsYVcJTjBM337QUN0fsiBzpwdNZmwnaQlaa83Y3 X-Received: by 2002:a17:906:6dd3:b0:742:296d:15c8 with SMTP id j19-20020a1709066dd300b00742296d15c8mr18620690ejt.550.1662999966208; Mon, 12 Sep 2022 09:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662999966; cv=none; d=google.com; s=arc-20160816; b=AtgGObLD2BfqdN0Mrh4JfRuPUOjq1ZaSCWZbI/HXkB+3Uybpe7JLWDnnovcSdhbh1Z jI/mW2ESWVjrsUu3IWu09+qTmygiDnwnHjVB3Q94fFDPGdTrrkbbJL7CXeH5i6TtQQ2y KtveZXubN6r60QZ7RcrtoslK6yEK4S/2xR9tHrzVyDDAooUNuMoK8z4DMIiOpl07rMN8 RJBPddDiPgkv1OTZNzgGcN8CTozvTZxlgABINYERjNHtmxb2/CVPHt7fI+OWOs6DQgy9 XQdGIxb4aivGAQjozgY1OT9j0EZSh3VhqZPqvDzkCfRn8zIsUs9w31jdvKNjazT1ADgd CRTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:to:from :subject:message-id:dkim-signature; bh=gQ11pEsscbOaR4ZH/Am1TvcbFgOjO+SitWBtq+AtPIE=; b=Oq09iX6YIa3tLX1jAfsRXwa5hLdoEzxW9g7fP9/jnDV0iCvXPGl/ILSzA5SV1DebNj 2X+ysbnNSKRKyhmx7tzlQ63W+CfKxz63+rzOtAZ9hLQyx8ICfqJWgHsWWCuJkBWNzUzj 51QOiksrxTLAl4Pk/dwXkZdm+TlPzFO1XGG+4jn5KOmSxCtqFd9SGuQKqSvQrkSbXj/o v2p4CCXN2t1F717IBVcULYm+duEkqCVjvVn8xMNSfYud7p904g45y4U4TvWG/uDoLDhM c4SLVWNG0ZGObxlOKxssg3/XSljX2OhnKnlZ3oqDG9RPi5u2s1hV/xWYiUsTyVfhOGVh k8/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OgkgqEqx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w26-20020a170906b19a00b007721f88d3e0si5631527ejy.554.2022.09.12.09.25.41; Mon, 12 Sep 2022 09:26:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OgkgqEqx; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbiILQUm (ORCPT + 99 others); Mon, 12 Sep 2022 12:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiILQUl (ORCPT ); Mon, 12 Sep 2022 12:20:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0E42315F for ; Mon, 12 Sep 2022 09:20:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F17561245 for ; Mon, 12 Sep 2022 16:20:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADCDEC433D6; Mon, 12 Sep 2022 16:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662999639; bh=yCvuqecQxJP5tSnVH0Tmm65khlb0vb/juPsP+q70WjQ=; h=Subject:From:To:Date:In-Reply-To:References:From; b=OgkgqEqxnWIkieuhnfPTlTK9zdr5VbiabIe0JAOL76C5AiPkL3AGshPNi9Eab/4Ph xZFPJWG7ohNcU5HB4NRiugomp4nVf7h3MTKMF+JNyZpJ/ej+xKtVp7WnSSFPG35LES 9yYRM8+qY7AscJ0dQuyrthW2XTv0v+eaIj+NuhaI56l58R98ZjwM1h5daIByfj5e+J cQmX3nXhUXHj7zUrZXnrnE1p2yae/LA1HYJF81O2qQlcxJBZfHAaW7mkONpYaXzFmY FHucBpjRTVHQERI5ToIYO0PDyvwbsfQH3f+CHlVBfQ0y0bxh5EoEIMqJ38d+zp5nb6 D903NP/6CYlKQ== Message-ID: Subject: Re: [PATCH v4 6/8] NFSD: Make nfsd4_setattr() wait before returning NFS4ERR_DELAY From: Jeff Layton To: Chuck Lever , linux-nfs@vger.kernel.org Date: Mon, 12 Sep 2022 12:20:37 -0400 In-Reply-To: <166267525333.1842.10708885965116635193.stgit@manet.1015granger.net> References: <166267495153.1842.14474564029477470642.stgit@manet.1015granger.net> <166267525333.1842.10708885965116635193.stgit@manet.1015granger.net> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Thu, 2022-09-08 at 18:14 -0400, Chuck Lever wrote: > nfsd_setattr() can kick off a CB_RECALL (via > notify_change() -> break_lease()) if a delegation is present. Before > returning NFS4ERR_DELAY, give the client holding that delegation a > chance to return it and then retry the nfsd_setattr() again, once. >=20 > Link: https://bugzilla.linux-nfs.org/show_bug.cgi?id=3D354 > Tested-by: Igor Mammedov > Signed-off-by: Chuck Lever > --- > fs/nfsd/vfs.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c > index 02f31d8c727a..03a826ccc165 100644 > --- a/fs/nfsd/vfs.c > +++ b/fs/nfsd/vfs.c > @@ -394,6 +394,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *f= hp, > int host_err; > bool get_write_count; > bool size_change =3D (iap->ia_valid & ATTR_SIZE); > + int retries; > =20 > if (iap->ia_valid & ATTR_SIZE) { > accmode |=3D NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE; > @@ -455,7 +456,13 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *= fhp, > } > =20 > inode_lock(inode); > - host_err =3D __nfsd_setattr(dentry, iap); > + for (retries =3D 1;;) { > + host_err =3D __nfsd_setattr(dentry, iap); > + if (host_err !=3D -EAGAIN || !retries--) > + break; Can __nfsd_setattr return -EAGAIN for entirely different reasons? I try_break_deleg will, but could an underlying filesystem's ->setattr operation return -EAGAIN for an unrelated reason? Then again, you're only retrying once, so maybe it's no big deal. > + if (!nfsd_wait_for_delegreturn(rqstp, inode)) > + break; > + } > if (attr->na_seclabel && attr->na_seclabel->len) > attr->na_labelerr =3D security_inode_setsecctx(dentry, > attr->na_seclabel->data, attr->na_seclabel->len); >=20 >=20 --=20 Jeff Layton