Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp3394595pxx; Mon, 2 Nov 2020 07:48:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwAqMw/nP+7m+j6lSqM/R1CgkmcmIowXO4Bj/xFYigMFofON7FYd9fjGIDfdvBnLBQLyynQ X-Received: by 2002:a17:906:fca:: with SMTP id c10mr16396637ejk.128.1604332126408; Mon, 02 Nov 2020 07:48:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604332126; cv=none; d=google.com; s=arc-20160816; b=xlHtthySQSEByI0/055yCUrGj8eEo0hiY5W4kG6c7EmqADpX6dsgT8lwRmk5GMgWuf m9B/TlZe67DjXLEdcg2YoOr84vD7cEUoK4jQA12pxQ3e5z0KTO/mz08WTRt7/Q9bFoSf styOODmGCy96eUa3f3VGzXYdt8M8cJ8V3c2W+Pv5ZYs0RIxL+m8sN2+a0vMcHv5B6BEU Q/7DyVnOlqp/vUMD09A81jS0j4kjRKnR8lNapO8cQXlYHg5JDuyIcx0e52R0TdI6dpBI L41YCa8Y3OOqWI1dnnyLviSSy1gL75lkUrypjorETg9tcyiMUB7WXBNRCIUqXZ4TD4UW nXkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=B2NpVlT2Tqs0vVEaNi5d49PtS4bqkN5GJUxAFWVig3A=; b=Pq2lw0A2UjP0G9ck2IpK4iXu+fmfDBFACjWw29RfjINA58qricrMu+L1w0afe0hOyG JybGYgcycWXAhlqixwrM9xcw72tCRknCHe4/3IFcMbPOw3d9RBxEiMZjMXA+s5MW4qYJ wZ4f2r0GvrMK5uvspugLDwvWCALDwtKusDGwQzGME02hshnaNX1MMEj4jNC9jUSO5k9w EVOALWPLu7QYyYIAtIj0mem6hE8XEV0DyQbcsjouagnhAIu4uFeNnW5xUNe/Q2k26jrO 8aaNh77pKQW4wXP9smxTt0vLeVjKrW+2juhLDZmdXfnXHHzilgDvyhz2Fi4C5y/XsTr4 80rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@desy.de header.s=default header.b=z1Ha0Di5; 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 pw16si10304983ejb.430.2020.11.02.07.48.13; Mon, 02 Nov 2020 07:48:46 -0800 (PST) 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=@desy.de header.s=default header.b=z1Ha0Di5; 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 S1726523AbgKBPsE (ORCPT + 99 others); Mon, 2 Nov 2020 10:48:04 -0500 Received: from smtp-o-3.desy.de ([131.169.56.156]:39700 "EHLO smtp-o-3.desy.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726228AbgKBPsE (ORCPT ); Mon, 2 Nov 2020 10:48:04 -0500 X-Greylist: delayed 553 seconds by postgrey-1.27 at vger.kernel.org; Mon, 02 Nov 2020 10:48:02 EST Received: from smtp-buf-3.desy.de (smtp-buf-3.desy.de [IPv6:2001:638:700:1038::1:a6]) by smtp-o-3.desy.de (Postfix) with ESMTP id 76E7D60618 for ; Mon, 2 Nov 2020 16:38:42 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp-o-3.desy.de 76E7D60618 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=desy.de; s=default; t=1604331522; bh=B2NpVlT2Tqs0vVEaNi5d49PtS4bqkN5GJUxAFWVig3A=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=z1Ha0Di5ZZ/W9yBCfN5n1aQj+7oYfYJAhNKYskJokuIw7Huc7Dj4dxL98pX0nxRN/ IvgFr+gA3UbO3q2bBOnxBdyVjoIrALBRILsoNnyzp9gDUqup4Fnrl+2v/sXbfeyiH+ GyQTJ30vBPXSfDh0sdGlORIHNxVZRZICWnLf9Fh4= Received: from smtp-m-3.desy.de (smtp-m-3.desy.de [IPv6:2001:638:700:1038::1:83]) by smtp-buf-3.desy.de (Postfix) with ESMTP id 6B35CA0586; Mon, 2 Nov 2020 16:38:42 +0100 (CET) X-Virus-Scanned: amavisd-new at desy.de Received: from z-mbx-2.desy.de (z-mbx-2.desy.de [131.169.55.140]) by smtp-intra-2.desy.de (Postfix) with ESMTP id 429F41001A7; Mon, 2 Nov 2020 16:38:42 +0100 (CET) Date: Mon, 2 Nov 2020 16:38:42 +0100 (CET) From: "Mkrtchyan, Tigran" To: David Wysochanski Cc: trondmy , Anna Schumaker , linux-nfs Message-ID: <1976524196.5308081.1604331522179.JavaMail.zimbra@desy.de> In-Reply-To: <1604325011-29427-12-git-send-email-dwysocha@redhat.com> References: <1604325011-29427-1-git-send-email-dwysocha@redhat.com> <1604325011-29427-12-git-send-email-dwysocha@redhat.com> Subject: Re: [PATCH 11/11] NFS: Bring back nfs_dir_mapping_need_revalidate() in nfs_readdir() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Mailer: Zimbra 8.8.15_GA_3959 (ZimbraWebClient - FF82 (Linux)/8.8.15_GA_3953) Thread-Topic: Bring back nfs_dir_mapping_need_revalidate() in nfs_readdir() Thread-Index: bZwTZ0y3Ndl+CBQ6m+AoYTaYUIw26w== Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hi Dave, ----- Original Message ----- > From: "David Wysochanski" > To: "trondmy" , "Anna Schumaker" > Cc: "linux-nfs" > Sent: Monday, 2 November, 2020 14:50:11 > Subject: [PATCH 11/11] NFS: Bring back nfs_dir_mapping_need_revalidate() in nfs_readdir() > commit 79f687a3de9e ("NFS: Fix a performance regression in readdir") > removed nfs_dir_mapping_need_revalidate() in an attempt to fix a > performance regression, but had the effect that with NFSv3 the > pagecache would never expire while a process was reading a directory. > An earlier patch addressed this problem by allowing the pagecache > to expire but the current process to continue using the last cookie > returned by the server when searching the pagecache, rather than > always starting at 0. Thus, bring back nfs_dir_mapping_need_revalidate() > so that nfsi->cache_validity & NFS_INO_INVALID_DATA will be seen > and nfs_revalidate_mapping() will be called with NFSv3 as well, > making it behave the same as NFSv4. > > Signed-off-by: Dave Wysochanski > --- > fs/nfs/dir.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c > index cbd74cbdbb9f..aeb086fb3d0a 100644 > --- a/fs/nfs/dir.c > +++ b/fs/nfs/dir.c > @@ -872,6 +872,17 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc) > return status; > } > > +static bool nfs_dir_mapping_need_revalidate(struct inode *dir) > +{ > + struct nfs_inode *nfsi = NFS_I(dir); > + > + if (nfs_attribute_cache_expired(dir)) > + return true; > + if (nfsi->cache_validity & NFS_INO_INVALID_DATA) > + return true; > + return false; > +} Is this the same as: static bool nfs_dir_mapping_need_revalidate(struct inode *dir) { struct nfs_inode *nfsi = NFS_I(dir); return nfs_attribute_cache_expired(dir) || nfsi->cache_validity & NFS_INO_INVALID_DATA); } Tigran. > + > /* The file offset position represents the dirent entry number. A > last cookie cache takes care of the common case of reading the > whole directory. > @@ -903,7 +914,7 @@ static int nfs_readdir(struct file *file, struct dir_context > *ctx) > * to either find the entry with the appropriate number or > * revalidate the cookie. > */ > - if (ctx->pos == 0 || nfs_attribute_cache_expired(inode)) > + if (ctx->pos == 0 || nfs_dir_mapping_need_revalidate(inode)) > res = nfs_revalidate_mapping(inode, file->f_mapping); > if (res < 0) > goto out; > -- > 1.8.3.1