Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6984788rwd; Mon, 19 Jun 2023 16:12:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WiFX1DFuQwTZ0n8TVmFubj92kHSZrzpHMjKlUfSnUBC1eYWThGtEj1MHzsu24GD/+tfFv X-Received: by 2002:a05:6808:199:b0:398:268e:4c7c with SMTP id w25-20020a056808019900b00398268e4c7cmr11600552oic.42.1687216336777; Mon, 19 Jun 2023 16:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687216336; cv=none; d=google.com; s=arc-20160816; b=PDpz7lZQEsb2j9PFmwCVfbfZH5g2xfcqiDa/AWliOFVLRVsc8Gm5qQvX4mZ7+zBRsw vhbVO27kCzLKR0p+jV5pCaBJ60XRpdnvj35Y9ux6xMTz8OkH+3ZAzK8D/VSKq7PL7Z3k 4h5GMEdfJHWWZccHIToZpbDpu0/iRNCgRP6fd04o99C7oBihbO6JfzVwDrd4w3pueiJE 3+3PMXT/1rTlJ5sV7m/wpT3HyHEDCxrG2X/OXobDqBGR/OiGkVzSVzkmADyH8I1oUm9O x/+lstKOKEnZLw4f1KEcm4DySCfN+2KGW54aPkW/J0yDEYPFGikvNhSvhWVjXner4x+l bSOg== 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=uuevwNfqJdBC4EHOgC0lRBwg5Gz4Btd5JsBTI52JGhk=; b=gr7+4fd1AtJ3nYQgDHFv8xKFOzvdE2HA/eAKkM46RRKBZH6FkvQl2nfQ872ruu+rBZ dbWef3l+8oVWBuCP8SM3GqgI7E3mT5XVliT4UpakdEtefn3ivvC4dCHg6KXaEyvDXxqR HZdKpgDekzq5jDQZZgkCIaw/4ArZr4rHQ25Tn13Y9BBJ3MCfpRaWlvF+syusxmY7GEzW 5D404PwzB7b7UhSECGjusLXVNWGXmHcIMT9sLPih02Lk0wft+R8yB1Gp3x/hmrQyULvF ItcnVcfYo69ZgFuPzT53CttQgSGWAvKomvAupyjXRJGLLFI3PI+zz7lrYxalOoTvw9jM edvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=o0ZQvJUu; 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=umich.edu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n17-20020a170902d2d100b001ac68acb1e8si690074plc.518.2023.06.19.16.11.52; Mon, 19 Jun 2023 16:12:16 -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=@umich.edu header.s=google-2016-06-03 header.b=o0ZQvJUu; 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=umich.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229789AbjFSWt4 (ORCPT + 99 others); Mon, 19 Jun 2023 18:49:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjFSWt4 (ORCPT ); Mon, 19 Jun 2023 18:49:56 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C5F5E54 for ; Mon, 19 Jun 2023 15:49:54 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2b072753301so11578921fa.1 for ; Mon, 19 Jun 2023 15:49:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; t=1687214992; x=1689806992; 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=uuevwNfqJdBC4EHOgC0lRBwg5Gz4Btd5JsBTI52JGhk=; b=o0ZQvJUuOKjWaGJ1pCArT1HiLdrSjx0+BKRw+h6cdequjTVT0yMGh2oqCErGI8PUic AWXYsrgzb5NrEd/ynR3E1xOqcQUyBN5g2SY53aiMgxb7z8WVHAllrtpEC+V1WiLdoIZv XDMYW4tXuwNI7HM5/6b8fDN8eN1i5dqpiBRRlpZ9s9Xo5ASnXJkZry9ggfITY4qswMCN U/1qy0R+3xD1C5OFlKqxQlXycduWlk1cWt7UU9g1h79y08zXwWp8MDWdtDaPTHIu+NMR tuDOEJJq9mPyoZ/4weuz8jU2Y1TvVsjQ6YxaTuvJjp/bzn7YA22HpH07OCnZAmWiqF3Y X8Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687214992; x=1689806992; 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=uuevwNfqJdBC4EHOgC0lRBwg5Gz4Btd5JsBTI52JGhk=; b=Nlw89OEl5poCuxEEWEVCvHCR5Fdh3Y4DuFUmCXQfoWmEpvt3vMa9nCDwdJ2IJAn/3J WhkfDo6n0cMBTcdWgm3meiBPsvoZDJXatgZCJkNlOG8fXoQFSr/xpTqxyaX++I7jaltK 5ch2WNSDkRLyjY6k011VN0I0vld1AlJRIIG7W8Glrl9yHkhAWB2hcAbBF0ikQ+62sXpb tMHUciSc034qfmO9MImJGMHBGWR0kG3AcZ+Z/47cZkUOFluv1RYCUcTRDzfK2D1J5/OP z7/1+Qp9vogXqnmaTD8F+Ftcpz1d8LyPGNWAZQwxZdsHaR0FnPeowAUYqsrUCfDA6A9P FXYw== X-Gm-Message-State: AC+VfDwecdp3O32UW4a8pwvFmkR6wejONcy7SyHLbmBwAWsNa5T1lKbh 7RdUDUHkCOE/8IVmVerc8sDrKhY+TPtSkejIlBThOs/+Sow= X-Received: by 2002:a2e:8e2f:0:b0:2b4:60c0:1ac9 with SMTP id r15-20020a2e8e2f000000b002b460c01ac9mr3825793ljk.2.1687214992016; Mon, 19 Jun 2023 15:49:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Olga Kornievskaia Date: Mon, 19 Jun 2023 18:49:38 -0400 Message-ID: Subject: Re: NFSv4.0 Linux client fails to return delegation To: Chuck Lever III Cc: Trond Myklebust , Dai Ngo , Linux NFS Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Mon, Jun 19, 2023 at 4:02=E2=80=AFPM Chuck Lever III wrote: > > > > > On Jun 19, 2023, at 3:19 PM, Trond Myklebust = wrote: > > > > Hi Dai, > > > > On Mon, 2023-06-19 at 10:02 -0700, dai.ngo@oracle.com wrote: > >> Hi Trond, > >> > >> I'm testing the NFS server with write delegation support and the > >> Linux client > >> using NFSv4.0 and run into a situation that needs your advise. > >> > >> In this scenario, the NFS server grants the write delegation to the > >> client. > >> Later when the client returns delegation it sends the compound PUTFH, > >> GETATTR > >> and DELERETURN. > >> > >> When the NFS server services the GETATTR, it detects that there is a > >> write > >> delegation on this file but it can not detect that this GETATTR > >> request was > >> sent from the same client that owns the write delegation (due to the > >> nature > >> of NFSv4.0 compound). As the result, the server sends CB_RECALL to > >> recall > >> the delegation and replies NFS4ERR_DELAY to the GETATTR request. > >> > >> When the client receives the NFS4ERR_DELAY it retries with the same > >> compound > >> PUTFH, GETATTR, DELERETURN and server again replies the > >> NFS4ERR_DELAY. This > >> process repeats until the recall times out and the delegation is > >> revoked by > >> the server. > >> > >> I noticed that the current order of GETATTR and DELEGRETURN was done > >> by > >> commit e144cbcc251f. Then later on, commit 8ac2b42238f5 was added to > >> drop > >> the GETATTR if the request was rejected with EACCES. > >> > >> Do you have any advise on where, on server or client, this issue > >> should > >> be addressed? > > > > This wants to be addressed in the server. The client has a very good > > reason for wanting to retrieve the attributes before returning the > > delegation here: it needs to update the change attribute while it is > > still holding the delegation in order to ensure close-to-open cache > > consistency. > > > > Since you do have a stateid in the DELEGRETURN, it should be possible > > to determine that this is indeed the client that holds the delegation. > > I think it needs to be made clear in a specification that this is > the intended and conventional server implementation needed for such > a COMPOUND. > > RFC 7530 Section 14.2 says: > > > The server will process the COMPOUND procedure by evaluating each of > > the operations within the COMPOUND procedure in order. > > 2nd paragraph of RFC 7530 Section 15.2.4 says: > > > The COMPOUND procedure is used to combine individual operations into > > a single RPC request. The server interprets each of the operations > > in turn. If an operation is executed by the server and the status of > > that operation is NFS4_OK, then the next operation in the COMPOUND > > procedure is executed. The server continues this process until there > > are no more operations to be executed or one of the operations has a > > status value other than NFS4_OK. > > Obviously in this case the client has sent a well-formed COMPOUND, > but it's not one the server can execute given the ordering > constraint spelled out above. > > Can you refer us to a part of any RFC that says it's appropriate > to look ahead at subsequent operations in an NFSv4.0 COMPOUND to > obtain a state or client ID? Otherwise the Linux client will have > the same problem with any server implementation that handles > GETATTR conflicts as described in RFC 7530 Section 16.7.5. I'm not sure if this is totally irrelevant here but for the NFSv4.2 COPY nfsd does look ahead into the following operations in order to determine if it should allow one of the filehandle that it can't resolve (ie because it's a source server filehandle) which it would normally return ERR_STALE if it were any other compound. But of course one can argue that the spec specifically says that server needs to look ahead. > Based on this language I don't believe NFSv4.0 clients can rely on > server implementations to look ahead for client ID information. In > my view the client ought to provide a client ID by placing a RENEW > before the GETATTR. Even in that case, the server implementation > might not be aware that it needs to save the client ID from the > RENEW operation. > > > -- > Chuck Lever > >