From patchwork Fri Jul 20 17:26:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 10538079 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 2FE1A6029B for ; Fri, 20 Jul 2018 17:26:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 129282967B for ; Fri, 20 Jul 2018 17:26:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03C9F29824; Fri, 20 Jul 2018 17:26:25 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 6E3032967B for ; Fri, 20 Jul 2018 17:26:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387992AbeGTSPh (ORCPT ); Fri, 20 Jul 2018 14:15:37 -0400 Received: from mail-ua0-f178.google.com ([209.85.217.178]:38971 "EHLO mail-ua0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387942AbeGTSPh (ORCPT ); Fri, 20 Jul 2018 14:15:37 -0400 Received: by mail-ua0-f178.google.com with SMTP id g18-v6so7929619uam.6 for ; Fri, 20 Jul 2018 10:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to:cc; bh=aBScuE+R1kvzD6Y1WdDJLgSCs1VsusTjQly7dYJpRig=; b=dBFBRc7y4OWWOYryEcCaQfu8vCs3Fkt/h995EzsdTTILNd4bdHUchuo3tt9OzJRZpH W3cD3tYFSPkaxHSkJ5+s4mVlrLwroIeq+dSmKMAdNziH90ytvJvGXHUIHEcAirMFVzYl kiHmuIC9eUU6ffBcp+ouE56Y+nUV/e7WW7Z7Yiv4A2GZMsKPc91xa01/F3CI/+8yqIDf yrUQeU7LxLz6th9Wsff5VaXrfT2M053NxctldXEFbO2GOUBJ3HstAawJzBweCtGFOsLu NtSaz91t9wFqq6nrNYTrjiZkIxuSqZBhFKlDu0WGPjBQp5WRNWn/AXcZKEOshuONpv0v rDPw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; h=mime-version:sender:from:date:message-id:subject:to:cc; bh=aBScuE+R1kvzD6Y1WdDJLgSCs1VsusTjQly7dYJpRig=; b=B1cJazyfGo1gbpxhS5gpDBXwojTUkqSjS6GaU6n0apUo02Uj2GLDtEh9sTwZ8hOh0T ySOg1PJdW4pEyN8NLo/tGim7n5AjiEviyx5Nk9olIyR1qFNOXTMotWTSBJh0vEP6tGvS MtVlKTVFKvSp3HSL3FLg8v7duJCi9dEQgyFZ6EWtlOYQrrGZrLA9fBL9F27C+IT6FVhh TauSTedWcOB8LDymIquqQW1K5W/B23vlvGWBJ/OaKPtQ4MoUJbxfE7V9sQP/51HQXUYh bOJnCregcadDCCIIGctkPVoRPpvONInyht3cZXyO2Iuh9hYlTSG6MGxWxC1hyz7jiLuY 1pjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:cc; bh=aBScuE+R1kvzD6Y1WdDJLgSCs1VsusTjQly7dYJpRig=; b=oTFT8ZxCi4eL7YeT0NulojUH6v+3wxmkq+2nAnqqDtef0CTr1jlbT5ztWeYKq3nblB dvZT12ShCVTSWHWxRcUl7sQv4ufVlft8rD8Dm5gPKv45u8oA66h2PpBq2k5jC39HJ5rW EbIpYhg7UtOOggBOMdLsv3/nhdI1nd5GVzmQLygUBRHY4fyf7eOuSM2/1LxZWFPpzrGc qckjGOxOOgojaikI9IOEZNUbufTeWsF/22r2PcbdKf614vz0wPLsQ/4WZSzERPsLIuzd uzzahFsNjoxFpPFceFKjGKKV4o27fY6ntO7kATDbRLUljr8ejgIFfZitxGoSfyIJwk60 KGDA== X-Gm-Message-State: AOUpUlHHNlUUcSrkGKPerIBIhryAPbWoFd431FfeKcxixND/faDNsgPZ xtM0pvj1LUhBxbi8sU9UmYWAvC2tpnE3Fz+ky1aOjnHw X-Google-Smtp-Source: AAOMgpek4VFAIVhNuxBQujNsd6StXuCORDdnNzJlOv4Csb/pqbJU8b5r/cLdftfXStFJ6EZQ3aE9w4PEOu5IK2D7fmc= X-Received: by 2002:ab0:590d:: with SMTP id n13-v6mr1975609uad.123.1532107581790; Fri, 20 Jul 2018 10:26:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:dc88:0:0:0:0:0 with HTTP; Fri, 20 Jul 2018 10:26:21 -0700 (PDT) From: Olga Kornievskaia Date: Fri, 20 Jul 2018 13:26:21 -0400 X-Google-Sender-Auth: cQXjL73Mfn4VsLafcFVi9gf_RZ4 Message-ID: Subject: sending duplicate GETATTRs To: Trond Myklebust Cc: linux-nfs 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 Hi Trond, I would some help understanding attributes management. Right now, any time a directory inode that was marked with INVALID_ACCESS (say to a change_attribute changed) ends up triggering sending a duplicate GETATTR. I don't think that's correct. In nfs_execute_ok() we check if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS)) and the call __nfs_revalidate_inode() which will trigger GETATTR. I don't understand why after calling this function the INVALID_ACCESS doesn't get cleared? Because that's what causes the double GETATTR to be sent. On the open path, the first time the getattr is sent is in Jul 19 15:39:52 ipa18 kernel: dump_stack+0x5a/0x73 Jul 19 15:39:52 ipa18 kernel: nfs4_proc_getattr+0x65/0x110 [nfsv4] Jul 19 15:39:52 ipa18 kernel: __nfs_revalidate_inode+0xe1/0x370 [nfs] Jul 19 15:39:52 ipa18 kernel: nfs_permission+0x16b/0x1f0 [nfs] Jul 19 15:39:52 ipa18 kernel: inode_permission+0xab/0x130 Jul 19 15:39:52 ipa18 kernel: link_path_walk+0x29d/0x520 Jul 19 15:39:52 ipa18 kernel: path_openat+0xf6/0x1230 Jul 19 15:39:52 ipa18 kernel: do_filp_open+0x91/0x100 Jul 19 15:39:52 ipa18 kernel: do_sys_open+0x126/0x210 Jul 19 15:39:52 ipa18 kernel: do_syscall_64+0x55/0x180 Jul 19 15:39:52 ipa18 kernel: entry_SYSCALL_64_after_hwframe+0x44/0xa9 And then again during the open Jul 19 15:39:52 ipa18 kernel: dump_stack+0x5a/0x73 Jul 19 15:39:52 ipa18 kernel: nfs4_proc_getattr+0x65/0x110 [nfsv4] Jul 19 15:39:52 ipa18 kernel: __nfs_revalidate_inode+0xe1/0x370 [nfs] Jul 19 15:39:52 ipa18 kernel: nfs_permission+0x16b/0x1f0 [nfs] Jul 19 15:39:52 ipa18 kernel: inode_permission+0xab/0x130 Jul 19 15:39:52 ipa18 kernel: path_openat+0x942/0x1230 Jul 19 15:39:52 ipa18 kernel: do_filp_open+0x91/0x100 Jul 19 15:39:52 ipa18 kernel: do_sys_open+0x126/0x210 Jul 19 15:39:52 ipa18 kernel: do_syscall_64+0x55/0x180 Jul 19 15:39:52 ipa18 kernel: entry_SYSCALL_64_after_hwframe+0x44/0xa9 Can't we remove INVALID_ACCESS after we revalidated the inode? This removes the duplicated GETATTRs. Is this a valid way of fixing this issue? --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 8f8e9e9..2b55a45 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2504,6 +2504,8 @@ static int nfs_execute_ok(struct inode *inode, int mask) if (mask & MAY_NOT_BLOCK) return -ECHILD; ret = __nfs_revalidate_inode(server, inode); + if (!ret) + NFS_I(inode)->cache_validity &= ~NFS_INO_INVALID_ACCESS; } if (ret == 0 && !execute_ok(inode)) ret = -EACCES;