Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1554618 > unrolled thread

[PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache

Started byFabian Frederick <fabf@skynet.be>
First post2017-01-09 20:20 +0100
Last post2017-01-09 20:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache Fabian Frederick <fabf@skynet.be> - 2017-01-09 20:20 +0100

#1554618 — [PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache

FromFabian Frederick <fabf@skynet.be>
Date2017-01-09 20:20 +0100
Subject[PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache
Message-ID<sXNE5-89F-1@gated-at.bofh.it>
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 <viro@zeniv.linux.org.uk>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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 = {
-- 
2.9.3

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web