Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp505446ybf; Fri, 28 Feb 2020 02:14:49 -0800 (PST) X-Google-Smtp-Source: APXvYqwOaHiiXv6EzSZZ0XT+V4YTZHuk8G1C3TcR1w/yiwcSAW3K/bZEPaxAitVHCbYIp3mtrSYy X-Received: by 2002:a05:6830:138b:: with SMTP id d11mr2524119otq.38.1582884889368; Fri, 28 Feb 2020 02:14:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582884889; cv=none; d=google.com; s=arc-20160816; b=kyiNeHa806rtLlgYjKPEEMWVnKrEcmecwVIkY2ewx6GMOaFs38oYlvtyl+pUGEk6Ro hfzrf+fo43Gxo4uSQCoMjNHIAoVD8ANzjM85q4REyX2j5Y3Mj1z7GgPV4EMp9OL6n673 30HyDE4OwYTgZUatuSZ1fMW6Z5zK11L5RDnq5hlPMUbnWZmDqPc8PuDPsJkt40mNxSFR Je3pXTZlz54xpqM0X3HW453rwXw2TJkQ3ahdkjwh1otLa1t4dM4oS9psSaPmhJDN4HG2 qH6N0VJ/wZR9t/5Sen2H5tzLE1phrph7kyPXly9Es5mN1EXE78UNM0ckMYOH2DgJY40V PVyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=posOSg33yU2pzo28icPumWCtqSF7Mtw95Q5NLrar9bY=; b=GlDO0JpV9FDMqKr0GPMzUGY1tpjK4fHXinULh/JsJl2tC9J1TWSqqX/hTZWLtTC5zu qrAFf3m/2vKWFek4HxVemwubwny2NgQ9amoXGf2/NwpTwE3MFOZKcfC7dkN+CppsjFSo NQa1XcVyfUxqKfLXc+Xhr9uhj0WihdKjhTUyZ41XT9STh12Cs1A5PxjInU4xuArZ7yfp tPoDUeHF1alnICag9k1GNJeG6ps64CkoPHcBjLroELWPOeQsFFNf354CwB2DKBjIqk33 mkPjq5iPUlwZ/IyLieXOpSS74j7epybFZAqOcfDYMsKGDsnvT7X+kiFutbhGEUtn4KVE I8qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JrDLbfZ/"; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si1557467oie.81.2020.02.28.02.14.23; Fri, 28 Feb 2020 02:14:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JrDLbfZ/"; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726614AbgB1KOW (ORCPT + 99 others); Fri, 28 Feb 2020 05:14:22 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:54621 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgB1KOW (ORCPT ); Fri, 28 Feb 2020 05:14:22 -0500 Received: by mail-pj1-f66.google.com with SMTP id dw13so1101046pjb.4; Fri, 28 Feb 2020 02:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=posOSg33yU2pzo28icPumWCtqSF7Mtw95Q5NLrar9bY=; b=JrDLbfZ/PmIIbx63hYM8+p6ar/p3z+1+vUKaxaKi6is08oHYv7EHVr68kmmk8K/8Eq Q1GYJA0aq4eR3usCTMVRPLRhX6FHarPtKbaZ0oJqyzkoKVWSDLL8h/DxGyrQVlT0O53F dqZb8TazqobPO5kOuLDc3GK0AUwII1lFrwbFeMHKqLf0MtFR0h63l+tifXm0cSUrTe5w YOTtgL/Uv/Elvww0pAP7dBzt32pqy6msNMj1lTtJtpyzgNV3c4ByqqRRMi4/ywBzPLco AkqOer2aFTIRHCVhny7IA/Ze43+22URAgPneWph4I4rtnIsfT2l+J+hQTwhPEGYOeof3 +CTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=posOSg33yU2pzo28icPumWCtqSF7Mtw95Q5NLrar9bY=; b=GxxVrgevF4TdrjiAKp8Kf3dbvrcYMbHGuj3oGEN/lblm53eQNkJjgKFVeD03f5TCBg kQt+ixsGJhWjG0eH9rHe8ZcjafMCuo6gUo+a49v9xII+JBgqnqcXe2Rcgjv2v1ozR8mm 0Js1gpGMyytbu+Qadk+Kb/u840hfEOqFH5JnhYeMBxYHwD5ojnhQmDEtPGS+CdfAMQEq 0TxLV0tAx3mqFQ0fPJWJmDpCRu+VmXX39TwXXXWB/jmMdPZx2yF1Z5xbeMoVx1bS5OT1 1WgjNweLFvc17+b+CO8FmozgYRRGFtd8W7QleYTSh6CzSSIq+hwsbufJ6QPTsStAQeft WpIw== X-Gm-Message-State: APjAAAVLtKKfEksYf8eWgINbLmhud4K5L/XuYEUqB8pEdWAsET233sbu ZrgbayjOksF+i2AMWSHUhlI= X-Received: by 2002:a17:902:788b:: with SMTP id q11mr3468519pll.44.1582884859902; Fri, 28 Feb 2020 02:14:19 -0800 (PST) Received: from localhost.localdomain ([154.223.142.197]) by smtp.gmail.com with ESMTPSA id p14sm9320954pgm.49.2020.02.28.02.14.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Feb 2020 02:14:19 -0800 (PST) From: Zhouyi Zhou To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, paulmck@linux.ibm.com, paulmck@linux.vnet.ibm.com, neilb@suse.com Cc: Zhouyi Zhou Subject: [PATCH] NFS:remove redundant call to nfs_do_access Date: Fri, 28 Feb 2020 10:14:07 +0000 Message-Id: <1582884847-20447-1-git-send-email-zhouzhouyi@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Also the rcu_read_lock and rcu_read_unlock is unnessarry because rcu critical data structure is already protected in nfs_access_get_cached_rcu. Tested in x86_64 Signed-off-by: Zhouyi Zhou --- fs/nfs/dir.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 193d6fb..37b0c10 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2732,14 +2732,7 @@ int nfs_permission(struct inode *inode, int mask) if (!NFS_PROTO(inode)->access) goto out_notsup; - /* Always try fast lookups first */ - rcu_read_lock(); - res = nfs_do_access(inode, cred, mask|MAY_NOT_BLOCK); - rcu_read_unlock(); - if (res == -ECHILD && !(mask & MAY_NOT_BLOCK)) { - /* Fast lookup failed, try the slow way */ - res = nfs_do_access(inode, cred, mask); - } + res = nfs_do_access(inode, cred, mask); out: if (!res && (mask & MAY_EXEC)) res = nfs_execute_ok(inode, mask); -- 1.7.1