From patchwork Mon Jan 9 19:12:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9505769 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 F0BA16071A for ; Mon, 9 Jan 2017 19:13:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB1672852B for ; Mon, 9 Jan 2017 19:13:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFF0228533; Mon, 9 Jan 2017 19:13:16 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 6B2F12852B for ; Mon, 9 Jan 2017 19:13:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423231AbdAITMv (ORCPT ); Mon, 9 Jan 2017 14:12:51 -0500 Received: from mailrelay103.isp.belgacom.be ([195.238.20.130]:5884 "EHLO mailrelay103.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164316AbdAITMV (ORCPT ); Mon, 9 Jan 2017 14:12:21 -0500 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2AeBACm33NY/2ZisVtdHgYMgmxOAQEBA?= =?us-ascii?q?QEfQIErjkmRWgGScYIPggqGIgKBZkAUAQIBAQEBAQEBYyiEaQYnLyMQGTg5HgY?= =?us-ascii?q?TiGMRsXg6hBCGDQEBCCiGRY8NBZsckUANkFySVR84gSQZGIRnHIFgPTWIZgEBA?= =?us-ascii?q?Q?= X-IPAS-Result: =?us-ascii?q?A2AeBACm33NY/2ZisVtdHgYMgmxOAQEBAQEfQIErjkmRWgG?= =?us-ascii?q?ScYIPggqGIgKBZkAUAQIBAQEBAQEBYyiEaQYnLyMQGTg5HgYTiGMRsXg6hBCGD?= =?us-ascii?q?QEBCCiGRY8NBZsckUANkFySVR84gSQZGIRnHIFgPTWIZgEBAQ?= Received: from 102.98-177-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.177.98.102]) by relay.skynet.be with ESMTP; 09 Jan 2017 20:12:16 +0100 From: Fabian Frederick To: Andrew Morton Cc: Jan Kara , Alexander Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, fabf@skynet.be Subject: [PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache Date: Mon, 9 Jan 2017 20:12:08 +0100 Message-Id: <20170109191208.6085-8-fabf@skynet.be> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170109191208.6085-1-fabf@skynet.be> References: <20170109191208.6085-1-fabf@skynet.be> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This adds get_parent function so that nfs client can still work after cache drop (Tested on NFS v4 with echo 3 > /proc/sys/vm/drop_caches) Suggested-by: Alexander Viro Signed-off-by: Fabian Frederick --- fs/affs/namei.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/fs/affs/namei.c b/fs/affs/namei.c index fb88446..a3df8a6 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -447,6 +447,24 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry, return retval; } +static struct dentry *affs_get_parent(struct dentry *child) +{ + struct inode *parent; + struct buffer_head *bh; + + bh = affs_bread(child->d_sb, d_inode(child)->i_ino); + if (IS_ERR(bh)) + return ERR_CAST(bh); + + parent = affs_iget(child->d_sb, + be32_to_cpu(AFFS_TAIL(child->d_sb, bh)->parent)); + brelse(bh); + if (IS_ERR(parent)) + return ERR_CAST(parent); + + return d_obtain_alias(parent); +} + static struct inode *affs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation) { @@ -484,6 +502,7 @@ static struct dentry *affs_fh_to_parent(struct super_block *sb, struct fid *fid, const struct export_operations affs_export_ops = { .fh_to_dentry = affs_fh_to_dentry, .fh_to_parent = affs_fh_to_parent, + .get_parent = affs_get_parent, }; const struct dentry_operations affs_dentry_operations = {