From patchwork Sat Dec 17 18:27:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 9479089 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 353B560827 for ; Sat, 17 Dec 2016 18:27:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2B337285B0 for ; Sat, 17 Dec 2016 18:27:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1FA7E285BB; Sat, 17 Dec 2016 18:27:21 +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 A3959285B0 for ; Sat, 17 Dec 2016 18:27:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754942AbcLQS1R (ORCPT ); Sat, 17 Dec 2016 13:27:17 -0500 Received: from mail-io0-f195.google.com ([209.85.223.195]:34045 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752296AbcLQS1Q (ORCPT ); Sat, 17 Dec 2016 13:27:16 -0500 Received: by mail-io0-f195.google.com with SMTP id y124so15270724iof.1 for ; Sat, 17 Dec 2016 10:27:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=b0yMKQ/Bu3Pw+JB0Y3sh7v6ZLZTG02IEKbpF/o2Args=; b=nj7DwA50hsY16C0yQOBtca8Oc744bhSY4byEQ03eNK/TBZOluaGjQm1szi6n/nx+VV 8OI6Tc9//kR/mFLrXc719Z+K5ON3n+5JIufiGHmi1FtMRpJeH+XLkcN4lsf+xXn3TKnP ne8mdB4qZKXvNv8OzcpgzJxCOk3yF3SXY93SLjDIkbEh7MpOCMQcUUU8dNWXug15Dz7Y gji779sw1Kfr8JeHHFR064HJbpUmjRazXv4zaSBYMWNa4SWBAMob/AmnWxb/l97yjpOZ TYQOz88Qt2xxw6frGpgnGc3iSiOd2PseB+nDxQNQbjJhob3IERAbMZi04duGILyYFLpV GfZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=b0yMKQ/Bu3Pw+JB0Y3sh7v6ZLZTG02IEKbpF/o2Args=; b=mm0MTUiL1F7l5qVQK+qeE9/jwtguGLShft8ZoQVS0fxCYDzrmtKGcrky1GwnMKoGha mJG7p6f6IX/+DCeBiIY7bF9I2JO017xxwH/AGOWxCUgktK5PaRvIYyUK4kEVelQLSXql czVuX6VVkSTFnmtvt+2iyMMWRVtLonWlZob+SsAeYRYq0B13+EYg7n3T/DQ40C3PV569 BFHZijntIehbXD3cetfNYZLvwJTZO4AgNKKxSYmGAVZcC6v2UD0DKVNkCFk4V707VLyk os+6ABeWV33St8l2SpQ60TyBncfJX5xxBq9cvsq2RfVQkt93Mdds0lLlXzO9ebfrDhXh UBmA== X-Gm-Message-State: AIkVDXJDobcMdf4j+qXpCsaB70U63n00IFT5Q3FcwpOkcmA3lSllFilGallbaT5Piknfcw== X-Received: by 10.107.11.26 with SMTP id v26mr9143006ioi.141.1481999235825; Sat, 17 Dec 2016 10:27:15 -0800 (PST) Received: from localhost.localdomain (c-68-49-162-121.hsd1.mi.comcast.net. [68.49.162.121]) by smtp.gmail.com with ESMTPSA id y125sm3587595ity.13.2016.12.17.10.27.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Dec 2016 10:27:15 -0800 (PST) From: Trond Myklebust To: linux-nfs@vger.kernel.org Subject: [PATCH 1/9] NFSv4: Don't invalidate the directory twice Date: Sat, 17 Dec 2016 13:27:03 -0500 Message-Id: <20161217182711.10643-2-trond.myklebust@primarydata.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161217182711.10643-1-trond.myklebust@primarydata.com> References: <20161217182711.10643-1-trond.myklebust@primarydata.com> 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 an operation that modified the directory raced with a GETATTR, then we don't need to invalidate the directory cache more than once. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d33242c8d95d..713932440e07 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1088,12 +1088,15 @@ static void update_changeattr(struct inode *dir, struct nfs4_change_info *cinfo) struct nfs_inode *nfsi = NFS_I(dir); spin_lock(&dir->i_lock); + if (dir->i_version == cinfo->after) + goto out; nfsi->cache_validity |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_DATA; if (!cinfo->atomic || cinfo->before != dir->i_version) nfs_force_lookup_revalidate(dir); dir->i_version = cinfo->after; nfsi->attr_gencount = nfs_inc_attr_generation_counter(); nfs_fscache_invalidate(dir); +out: spin_unlock(&dir->i_lock); }