Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp703422pxk; Thu, 1 Oct 2020 11:41:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwq/jzEy102jFz6a2zpcvaHfRo7uvZb9M8QpSExb+mfadgP5ozHm5uOTUTY8bR8OIxGR1TG X-Received: by 2002:a17:906:7e53:: with SMTP id z19mr2269204ejr.334.1601577711038; Thu, 01 Oct 2020 11:41:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601577711; cv=none; d=google.com; s=arc-20160816; b=sjhPU2VdxnStYIw2ONlnFIVqg3H9MWZprXhCX3CV6nZqBxB2Zey8II4Ruf2RicA7T8 2rP0fLkn4nZIhhQrvNqKwqLBGd+Z3Bj5s/bRVhPFOZCiENTfsUJSCZMLNOV2aa1Am9To JCUf4PNpybdXJ9U+UlV3mHFr1njrKawnUU4JvUPod5o0dxsaOJyHCKNhiOy/Bb7kHUXq qWP1gon6zjCY4wT3U+uhbCSYWZPBe/hXsNLvQbFFYQSUKlKdQLhfaO1t7sFBrj3wHTk3 QWcd6CqBGr+9kOys37VTcWXFiPhjIKwU73dO7IRZdovOooWcJFlGDgcm396EJpXbAz1p c/9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:from:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:date :dkim-signature:dkim-filter; bh=+Gud44h/DwgTXrk8DT7tVjKcn8XnzdMmrGsrqdJ/P0g=; b=IEfgqarVfUJzM+7P9Hgct4wsQURfMbKpC5GpJShPMqrQtYHHhGFhKm8FkUZRSJkHQO y7t+rtaZe5lffYIoVjIY/qY7XJDrhAjk0i8rtIWnP8KFM/VehyaRHKIB96hizA42bwAQ drCIGH40b6uifc71BAc+4BX/QO98xOs51Lhvrcp8PpB6CFgxKKrPvjwjYeQQ9arb9ym2 ypWmKeXc89GG/VK8KM9MIMwqwY1Gc5aYkFEmhhxCmH3f18pO0eLzlgzaGFNiXXbNdZCU zWwZRw++s6zuRuwyaKJrw4HEV5TjgmN3RU/sJsswjLBkwjd2cSpMBORZPLaqVNLe+iJm lWhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fieldses.org header.s=default header.b=X5lcJDHh; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d24si3878071edv.518.2020.10.01.11.41.20; Thu, 01 Oct 2020 11:41:51 -0700 (PDT) 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=@fieldses.org header.s=default header.b=X5lcJDHh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729993AbgJASlT (ORCPT + 99 others); Thu, 1 Oct 2020 14:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729047AbgJASlT (ORCPT ); Thu, 1 Oct 2020 14:41:19 -0400 Received: from fieldses.org (fieldses.org [IPv6:2600:3c00:e000:2f7::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 812FCC0613E2 for ; Thu, 1 Oct 2020 11:41:19 -0700 (PDT) Received: by fieldses.org (Postfix, from userid 2815) id EFA3367A2; Thu, 1 Oct 2020 14:41:18 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.11.0 fieldses.org EFA3367A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fieldses.org; s=default; t=1601577678; bh=+Gud44h/DwgTXrk8DT7tVjKcn8XnzdMmrGsrqdJ/P0g=; h=Date:To:Cc:Subject:References:In-Reply-To:From:From; b=X5lcJDHhdNICZpQItgfe2uiJDCdWsfP6x4yxfqas108SMAmHf22CpJWs+Ox9COAvn MhxPdIn5FvLsr5JS10shsmSVuTPsJ7Q6jSO37sD5Nz6MEp7fmm7slM299UVrwQnouf MxI/qvuBMF0whOE/bU+hPiqugr/ZksBL6CrkOCGw= Date: Thu, 1 Oct 2020 14:41:18 -0400 To: Jeff Layton Cc: Daire Byrne , linux-nfs , linux-cachefs Subject: Re: [Linux-cachefs] Adventures in NFS re-exporting Message-ID: <20201001184118.GE1496@fieldses.org> References: <943482310.31162206.1599499860595.JavaMail.zimbra@dneg.com> <1155061727.42788071.1600777874179.JavaMail.zimbra@dneg.com> <97eff1ee2886c14bcd7972b17330f18ceacdef78.camel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <97eff1ee2886c14bcd7972b17330f18ceacdef78.camel@kernel.org> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Sep 30, 2020 at 03:30:22PM -0400, Jeff Layton wrote: > On Tue, 2020-09-22 at 13:31 +0100, Daire Byrne wrote: > > This patch helps to avoid this when applied to the re-export server but there may be other places where this happens too. I accept that this patch is probably not the right/general way to do this, but it helps to highlight the issue when re-exporting and it works well for our use case: > > > > --- linux-5.5.0-1.el7.x86_64/fs/nfs/inode.c 2020-01-27 00:23:03.000000000 +0000 > > +++ new/fs/nfs/inode.c 2020-02-13 16:32:09.013055074 +0000 > > @@ -1869,7 +1869,7 @@ > > > > /* More cache consistency checks */ > > if (fattr->valid & NFS_ATTR_FATTR_CHANGE) { > > - if (!inode_eq_iversion_raw(inode, fattr->change_attr)) { > > + if (inode_peek_iversion_raw(inode) < fattr->change_attr) { > > /* Could it be a race with writeback? */ > > if (!(have_writers || have_delegation)) { > > invalid |= NFS_INO_INVALID_DATA > > > > With this patch, the re-export server's NFS client attribute cache is maintained and used by all the clients that then mount it. When many hundreds of clients are all doing similar things at the same time, the re-export server's NFS client cache is invaluable in accelerating the lookups (getattrs). > > > > Perhaps a more correct approach would be to detect when it is knfsd that is accessing the client mount and change the cache consistency checks accordingly? > > Yeah, I don't think you can do this for the reasons Trond outlined. I'm not clear whether Trond thought that knfsd's behavior in the case it returns NFS4_CHANGE_TYPE_IS_MONOTONIC_INCR might be good enough to allow this or some other optimization. --b.