From patchwork Tue Oct 20 18:37:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11847645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A83117EC for ; Tue, 20 Oct 2020 18:39:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 467F42224A for ; Tue, 20 Oct 2020 18:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603219180; bh=cgrozDlS18uUWHQbhKg4LtQ89oDU0R79IgAi9RatH3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=DaavFQkX5o8gGDsPYEpEJ7XQI/oau5PJ8/svltWtO0O9wFfU+jRpYp/1iRepk+wj3 nI8bzeSaM9b/XRe8lN4tV8LGQ4DRtnvZWQoYXLQTVCMy4e1xtIPX5r4rm5s2Yg7xeR NuXxyl/6Uj3kZyQ0++ZowvXuxP9rjBTCgoORVr2s= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389303AbgJTSjj (ORCPT ); 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 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 = { From patchwork Tue Oct 20 18:37:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11847647 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE90D1B40 for ; Tue, 20 Oct 2020 18:39:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CAC92225C for ; Tue, 20 Oct 2020 18:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603219180; bh=7IrIMMQkcopHIXh1Zf2vGRw26VOb596iexSYLcJNyhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xr/OxMEKbQ+Y23U25565b6y53GyGFP62MbUO21Esm4gfVCGhK8IyuiQbFokQ3SbVB BFo/dsuWNHHdjhWWV9Chz4uxGZo4/baGoDKcMwRcpu3ltRhZunV1ZWCBqUFqkMhpjy 1l7MFD+tKBTC3J+lHy3hA+1CBUExxxBCOkWCqTgQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389145AbgJTSjk (ORCPT ); Tue, 20 Oct 2020 14:39:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:51838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389212AbgJTSjk (ORCPT ); Tue, 20 Oct 2020 14:39:40 -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 0BA012223C; 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=1603219179; bh=7IrIMMQkcopHIXh1Zf2vGRw26VOb596iexSYLcJNyhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pUJ5yt+0KQU2zjd/q74cn0dQ+JapBaHZ3bYPBU5kQ+NCE+g+8Li7vvsiy8vIo93vY bg1PfLmrFR/6c1GHhOYOT5GH7ORIOuY4rJWuBk41TG7w7/S1G3a1oXUvrLNHuq/5XC iIQNgzZ1sVD8h8vT1zyiXIP8NazVECb+fDy5Aa5M= From: trondmy@kernel.org To: Daire Byrne Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 2/3] NFSv3: Add emulation of the lookupp() operation Date: Tue, 20 Oct 2020 14:37:17 -0400 Message-Id: <20201020183718.14618-3-trondmy@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201020183718.14618-2-trondmy@kernel.org> References: <279389889.68934777.1603124383614.JavaMail.zimbra@dneg.com> <20201020183718.14618-1-trondmy@kernel.org> <20201020183718.14618-2-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust In order to use the open_by_filehandle() operations on NFSv3, we need to be able to emulate lookupp() so that nfs_get_parent() can be used to convert disconnected dentries into connected ones. Signed-off-by: Trond Myklebust --- fs/nfs/nfs3proc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c index acbdf7496d31..6b66b73a50eb 100644 --- a/fs/nfs/nfs3proc.c +++ b/fs/nfs/nfs3proc.c @@ -209,6 +209,20 @@ nfs3_proc_lookup(struct inode *dir, struct dentry *dentry, task_flags); } +static int nfs3_proc_lookupp(struct inode *inode, struct nfs_fh *fhandle, + struct nfs_fattr *fattr, struct nfs4_label *label) +{ + const char dotdot[] = ".."; + const size_t len = strlen(dotdot); + unsigned short task_flags = 0; + + if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL) + task_flags |= RPC_TASK_TIMEOUT; + + return __nfs3_proc_lookup(inode, dotdot, len, fhandle, fattr, + task_flags); +} + static int nfs3_proc_access(struct inode *inode, struct nfs_access_entry *entry) { struct nfs3_accessargs arg = { @@ -1015,6 +1029,7 @@ const struct nfs_rpc_ops nfs_v3_clientops = { .getattr = nfs3_proc_getattr, .setattr = nfs3_proc_setattr, .lookup = nfs3_proc_lookup, + .lookupp = nfs3_proc_lookupp, .access = nfs3_proc_access, .readlink = nfs3_proc_readlink, .create = nfs3_proc_create, From patchwork Tue Oct 20 18:37:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 11847649 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B68F917F7 for ; Tue, 20 Oct 2020 18:39:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 965902222C for ; Tue, 20 Oct 2020 18:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603219181; bh=y1GZHeyFiLzYGhfnTxlC1KUcazwO2ji8I77P8rOG2Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FnlQp42wlKuqMDyPtOHrphCb0FWWGqkH3/+Lewwg6VUy8Pg9qzMHu9Nk7r57Hzs3F B9riNbVpvZdObrDj8/OttBvaBUG2J3vLrFxIIGCcSE7j4hubw10j/fjhy70Ldi7LEV 23Ee49b4VPPHZILz+q5R8ugecSNaJBmFGGTJszCw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2437496AbgJTSjl (ORCPT ); Tue, 20 Oct 2020 14:39:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:51846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389212AbgJTSjk (ORCPT ); Tue, 20 Oct 2020 14:39:40 -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 A7B8922247; Tue, 20 Oct 2020 18:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603219180; bh=y1GZHeyFiLzYGhfnTxlC1KUcazwO2ji8I77P8rOG2Qo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GH3yjRxHX5xXBwDCYn6O4FSWYK+zZb6e+TvYCJ1xrkRlIOhyo7pFi9Fqwgf3QTPd4 Q3bfU4WlkZ6X0z4qZr8WKxdsKLbqcOCxvDJ8/AFPunjNBJRU3lWwFYgXYyFId1d8Mk BsTBK+ukEAAXLGcC+co5jmwk/cwvaGOox+u96LSE= From: trondmy@kernel.org To: Daire Byrne Cc: linux-nfs@vger.kernel.org Subject: [PATCH v3 3/3] NFSv4: Observe the NFS_MOUNT_SOFTREVAL flag in _nfs4_proc_lookupp Date: Tue, 20 Oct 2020 14:37:18 -0400 Message-Id: <20201020183718.14618-4-trondmy@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201020183718.14618-3-trondmy@kernel.org> References: <279389889.68934777.1603124383614.JavaMail.zimbra@dneg.com> <20201020183718.14618-1-trondmy@kernel.org> <20201020183718.14618-2-trondmy@kernel.org> <20201020183718.14618-3-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust We need to respect the NFS_MOUNT_SOFTREVAL flag in _nfs4_proc_lookupp, by timing out if the server is unavailable. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4proc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index bdf33e18fc54..c306c97c1ed0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -4376,6 +4376,10 @@ static int _nfs4_proc_lookupp(struct inode *inode, .rpc_argp = &args, .rpc_resp = &res, }; + unsigned short task_flags = 0; + + if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL) + task_flags |= RPC_TASK_TIMEOUT; args.bitmask = nfs4_bitmask(server, label); @@ -4383,7 +4387,7 @@ static int _nfs4_proc_lookupp(struct inode *inode, dprintk("NFS call lookupp ino=0x%lx\n", inode->i_ino); status = nfs4_call_sync(clnt, server, &msg, &args.seq_args, - &res.seq_res, 0); + &res.seq_res, task_flags); dprintk("NFS reply lookupp: %d\n", status); return status; }