From patchwork Wed Nov 25 18:50:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 7702421 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 39EA99F2E9 for ; Wed, 25 Nov 2015 18:50:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6BB0220789 for ; Wed, 25 Nov 2015 18:50:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F17C520621 for ; Wed, 25 Nov 2015 18:50:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750840AbbKYSuS (ORCPT ); Wed, 25 Nov 2015 13:50:18 -0500 Received: from mail-qg0-f50.google.com ([209.85.192.50]:36192 "EHLO mail-qg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750755AbbKYSuR (ORCPT ); Wed, 25 Nov 2015 13:50:17 -0500 Received: by qgcc31 with SMTP id c31so38654010qgc.3 for ; Wed, 25 Nov 2015 10:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poochiereds-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=zP1T0EXkkKLdyLLXp6yVjLr5u5BQ72/lXCnjDx2utL0=; b=WZ+HnmmDaoOj7hSw67FgI0L1eGDzO5zErsykhU1NAustXj7z7y106jrD5EKg4DKXG4 wdXKy+sGYn/4kWJW27epvSfnmzRmzq2o5Z1ZGY+z9e75KMUPil2y9KQ8/a3SVWWnGnuS FolO37LiTADfVTMSTSwSPURI89VILZuoSmUzNcjerChHpqCVvCSvXZUCx0E6DTOfJLtr aY0Ow81ZTRNYPKeGaow6Ta79frmuuYkWDB3km+dC+K17wA69cfkkvemA3Rm3LO/J7eei 5K2JKXQvXS8l90BXLn9OxIPaIsJq6+RGb83kHiJbaJpQ8CrscVuGiwF83xSAy08gnJds w3AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zP1T0EXkkKLdyLLXp6yVjLr5u5BQ72/lXCnjDx2utL0=; b=VQ4j6+f1yU+jFzhW1hW+TNc/g+/HfEUACYYkKXy4tMmECg+BMZqPXioHrncqavGu33 PI6FLm4bNphR3M8Rif9LYfq/nbqyex2qjD+MwZoVJyB1zZXzm20zXfUKaY34NSrjCwyt xL6i7y357DgQVt2ONbR1E6hOmVdX6e35T5XVFZsV28MQvcA8w7cS02VlQR8l0WSnWdoh szCUgoMTv9swh117dmCUkHYrzuqrWWtnPYBo0xM2A/XGP5KMX+Nfg4ZI624yQaxhwD1m xMRSWJiXvCy2OSI94YQpST9ghsq1K/kI8s6DKW0FuXx4p8l39TOEbkJkGhVY/yaVlDE0 D91g== X-Gm-Message-State: ALoCoQlXS4fRS6RxUOUzY2RPzYpvnyYjvfVuD/nIyRTnYavOiLEdLK8RXZK02uYQTc3l52MQXmgb X-Received: by 10.140.156.199 with SMTP id c190mr42788917qhc.85.1448477416770; Wed, 25 Nov 2015 10:50:16 -0800 (PST) Received: from tlielax.poochiereds.net ([2606:a000:1125:4075::d5a]) by smtp.googlemail.com with ESMTPSA id v202sm5881473qka.38.2015.11.25.10.50.15 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 10:50:16 -0800 (PST) From: Jeff Layton X-Google-Original-From: Jeff Layton To: trond.myklebust@Primarydata.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH] nfs: if we have no valid attrs, then don't declare the attribute cache valid Date: Wed, 25 Nov 2015 13:50:11 -0500 Message-Id: <1448477411-17721-1-git-send-email-jeff.layton@primarydata.com> X-Mailer: git-send-email 2.4.3 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If we pass in an empty nfs_fattr struct to nfs_update_inode, it will (correctly) not update any of the attributes, but it then clears the NFS_INO_INVALID_ATTR flag, which indicates that the attributes are up to date. Don't clear the flag if the fattr struct has no valid attrs to apply. Reviewed-by: Steve French Signed-off-by: Jeff Layton --- fs/nfs/inode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 326d9e10d833..ffdf9b9e88ab 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1824,7 +1824,11 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) if ((long)fattr->gencount - (long)nfsi->attr_gencount > 0) nfsi->attr_gencount = fattr->gencount; } - invalid &= ~NFS_INO_INVALID_ATTR; + + /* Don't declare attrcache up to date if there were no attrs! */ + if (fattr->valid != 0) + invalid &= ~NFS_INO_INVALID_ATTR; + /* Don't invalidate the data if we were to blame */ if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)))