Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4670696pxu; Wed, 21 Oct 2020 02:12:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyT4A8EHnhBle8VCJvRRGzMAqD1V4vZwm59PTGfTZk3YESnJ32hSwWKGcxE+8M6J5dU0JZM X-Received: by 2002:a17:907:43c3:: with SMTP id i3mr2330438ejs.231.1603271537561; Wed, 21 Oct 2020 02:12:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603271537; cv=none; d=google.com; s=arc-20160816; b=tCSc+oeFR4pnvKMNe2WRPXj91tjHoWHDudyUO18/fIaHrpmWQiX+pdSR12HFtqUjIV nKcxpOg/x8IjQSSgP7NeTNU1nMJ059QwXdMJTA6OKCQIn2SswDyc6dipSCdntlaieNMt Oz9JCJXV9w9rsAzTogCbdFxC0UG8OIQM6c5Iws1mTTCDpeY+Eh6l1BUGfZ3SXUcsyvWY FvkJpuF1zAWjf4ynl9ub3k2E8mDn7+EBTkQrS4aoLIxcYRlEk6gQAVcH+qECHl/9N3uX jdpwMLZj6kCpDbk7IGkbw3Kdf6g5pXgULbWL4/dIT9IXfrCPCckW9xGhLD6lTV9JqouE yVCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WUs/RJ1Q/Z/Ado9mywAGybznA8AgWTNaEgreAufRC3I=; b=Jcu4jTDENw/Cz591XYIv9FtvqPGOYxEtNbUlgd37geLZvuYx1DN5jXJX0Qx34NxboJ s2FNTnAqF/Tti3+KFq71p5O344FVLPRlqdyp/fczntA3WELCadQumx/PGalDTo3qzXs+ 1EGUCDPDhjGZ9OznvFrLU2fS634qdfaBn1HG7v2I9xhWarR1CJmk7/UVAehb7bJszsSa smAWN776zAS9hPb4gE6ljL8s/5w7/CEWlh5V7FuXu1ujAQcIejVK4kFyEcc4RSdhNXc5 becgG/DAgFjFc41OncrT3p98DplHSKP0iQZpxGh5xKlTrahsaFpyd+Ui2bWRixRxF7Rv B2AQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eP902lcR; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd21si937096edb.91.2020.10.21.02.11.54; Wed, 21 Oct 2020 02:12:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eP902lcR; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389303AbgJTSjj (ORCPT + 99 others); Tue, 20 Oct 2020 14:39:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:51830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389145AbgJTSjj (ORCPT ); Tue, 20 Oct 2020 14:39:39 -0400 Received: from localhost.localdomain (c-68-36-133-222.hsd1.mi.comcast.net [68.36.133.222]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5E8C22222C; Tue, 20 Oct 2020 18:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603219178; bh=cgrozDlS18uUWHQbhKg4LtQ89oDU0R79IgAi9RatH3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eP902lcRnrLGdj3arWuBuUkCpeZgu13IJ6fMar+tntsMntiJR9HImn+kn/DORqJC6 Pob/DJELD0NItdZlne3ibOxVYVhxWW2Zq2bfIsDFFG2typ5RkzDtQQouO7cwDLyukw 6jG7Wd71qKBkx6wWmNWfkkzYCQSQupinm7rbVysg= From: trondmy@kernel.org To: Daire Byrne Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 1/3] NFSv3: Refactor nfs3_proc_lookup() to split out the dentry Date: Tue, 20 Oct 2020 14:37:16 -0400 Message-Id: <20201020183718.14618-2-trondmy@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201020183718.14618-1-trondmy@kernel.org> References: <279389889.68934777.1603124383614.JavaMail.zimbra@dneg.com> <20201020183718.14618-1-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust We want to reuse the lookup code in NFSv3 in order to emulate the NFSv4 lookupp operation. Signed-off-by: Trond Myklebust --- fs/nfs/nfs3proc.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index 2397ceedba8a..acbdf7496d31 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c @@ -154,14 +154,14 @@ nfs3_proc_setattr(struct dentry *dentry, struct nfs_fattr *fattr, } static int -nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, - struct nfs_fh *fhandle, struct nfs_fattr *fattr, - struct nfs4_label *label) +__nfs3_proc_lookup(struct inode *dir, const char *name, size_t len, + struct nfs_fh *fhandle, struct nfs_fattr *fattr, + unsigned short task_flags) { struct nfs3_diropargs arg = { .fh = NFS_FH(dir), - .name = dentry->d_name.name, - .len = dentry->d_name.len + .name = name, + .len = len }; struct nfs3_diropres res = { .fh = fhandle, @@ -173,17 +173,11 @@ nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, .rpc_resp = &res, }; int status; - unsigned short task_flags = 0; - - /* Is this is an attribute revalidation, subject to softreval? */ - if (nfs_lookup_is_soft_revalidate(dentry)) - task_flags |= RPC_TASK_TIMEOUT; res.dir_attr = nfs_alloc_fattr(); if (res.dir_attr == NULL) return -ENOMEM; - dprintk("NFS call lookup %pd2\n", dentry); nfs_fattr_init(fattr); status = rpc_call_sync(NFS_CLIENT(dir), &msg, task_flags); nfs_refresh_inode(dir, res.dir_attr); @@ -198,6 +192,23 @@ nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, return status; } +static int +nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, + struct nfs_fh *fhandle, struct nfs_fattr *fattr, + struct nfs4_label *label) +{ + unsigned short task_flags = 0; + + /* Is this is an attribute revalidation, subject to softreval? */ + if (nfs_lookup_is_soft_revalidate(dentry)) + task_flags |= RPC_TASK_TIMEOUT; + + dprintk("NFS call lookup %pd2\n", dentry); + return __nfs3_proc_lookup(dir, dentry->d_name.name, + dentry->d_name.len, fhandle, fattr, + task_flags); +} + static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) { struct nfs3_accessargs arg = { -- 2.26.2