From patchwork Tue Jun 14 19:05:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9176695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A4136075D for ; Tue, 14 Jun 2016 19:05:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33B49200F5 for ; Tue, 14 Jun 2016 19:05:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28A222793D; Tue, 14 Jun 2016 19:05:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B719A200F5 for ; Tue, 14 Jun 2016 19:05:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752897AbcFNTFi (ORCPT ); Tue, 14 Jun 2016 15:05:38 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:36238 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752710AbcFNTFi (ORCPT ); Tue, 14 Jun 2016 15:05:38 -0400 Received: by mail-it0-f65.google.com with SMTP id h190so412479ith.3 for ; Tue, 14 Jun 2016 12:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id; bh=pZpTvyoo18bk5cW0fsWlSAaIZhzexGvf4cx6AJJFl4g=; b=Phd34oURU9LjNKFWny76pcVh/iGgmuvPBAriPdNtXjLHQq5QI/nGL+22Yjc8u0gKAp 09ZN07n0BFZtt1ZVcu28Gtyc/bVKT0MP0S2T3cTQIk/RdBjoblt+D3vfPRNbM3/NoACy Wrqhf7tu1j2PqMZZ/UUxIb6XSbIa4g1O3rNxdJBJV+uaQzGSv/SUuzQ1L1OUg8SZIAK8 Ec8XugWfqvTG4MZXgsGjUHIo8NCrx3m2kv4/7KNvWNFoMYUHZPJodkSjkoegwKgHW0z1 SQJhcl/awoZSugBbWXWuzXMEphjzQyzpAQIsiJM8BtO37wAQNDxRUu5oO+aQr76g8JO9 6tEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=pZpTvyoo18bk5cW0fsWlSAaIZhzexGvf4cx6AJJFl4g=; b=hZUGMUOyipi2LbMXnouMpjs4TGolm9gXzbwHo8tuzhkb03j7/M7aLKMUfiAxS+4ngW fhrz4LMzGagt+Oy4viKjZKxAsTr599qd0yc/i3b9lapGNA3sDkPwoGUbMue0L4ji+yT5 96PNmXtSwDOXo643KGJnWPYxh3n8iMJ0yR+98xJTxk30w9mZLBAHiphzQruLX8RwP+ti AF89y7EG/kUrE6tqbrAdeOj8oB/teHd+AxLTDap10C1rMECSnm+qhBrxulptGIgivSaq QaBeWYNOVpMdOYDrfsx+Vfnf0dor/+WauVZBF9bsOA13uUsEd5EP1e6JtGJVm6mKgBF8 I7+g== X-Gm-Message-State: ALyK8tIqC49bx5qgmVqoTZqKEHVL7xwdzaoxYtvoiYWW1ZKf0ikKTsaDSjIZS35u4ixGdA== X-Received: by 10.36.37.73 with SMTP id g70mr10544413itg.51.1465931137578; Tue, 14 Jun 2016 12:05:37 -0700 (PDT) Received: from leira.trondhjem.org.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id o4sm2458378itc.18.2016.06.14.12.05.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Jun 2016 12:05:37 -0700 (PDT) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 01/12] NFS: Don't flush caches for a getattr that races with writeback Date: Tue, 14 Jun 2016 15:05:04 -0400 Message-Id: <1465931115-30784-1-git-send-email-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.5.5 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If there were outstanding writes then chalk up the unexpected change attribute on the server to them. Signed-off-by: Trond Myklebust --- fs/nfs/inode.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 52e7d6869e3b..60051e62d3f1 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -1729,12 +1729,15 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) if (inode->i_version != fattr->change_attr) { dprintk("NFS: change_attr change on server for file %s/%ld\n", inode->i_sb->s_id, inode->i_ino); - invalid |= NFS_INO_INVALID_ATTR - | NFS_INO_INVALID_DATA - | NFS_INO_INVALID_ACCESS - | NFS_INO_INVALID_ACL; - if (S_ISDIR(inode->i_mode)) - nfs_force_lookup_revalidate(inode); + /* Could it be a race with writeback? */ + if (nfsi->nrequests == 0) { + invalid |= NFS_INO_INVALID_ATTR + | NFS_INO_INVALID_DATA + | NFS_INO_INVALID_ACCESS + | NFS_INO_INVALID_ACL; + if (S_ISDIR(inode->i_mode)) + nfs_force_lookup_revalidate(inode); + } inode->i_version = fattr->change_attr; } } else {