linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fabian Frederick <fabf@skynet.be>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jan Kara <jack@suse.cz>, Alexander Viro <viro@zeniv.linux.org.uk>,
	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	[thread overview]
Message-ID: <20170109191208.6085-8-fabf@skynet.be> (raw)
In-Reply-To: <20170109191208.6085-1-fabf@skynet.be>

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


  parent reply	other threads:[~2017-01-09 19:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 1/7 linux-next] fs/affs: remove reference to affs_parent_ino() Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 2/7 linux-next] fs/affs: add validation block function Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 3/7 linux-next] fs/affs: make affs exportable Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 4/7 linux-next] fs/affs: use octal for permissions Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 5/7 linux-next] fs/affs: add prefix to some functions Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 6/7 linux-next] fs/affs/namei.c: forward declarations clean-up Fabian Frederick
2017-01-09 19:12 ` Fabian Frederick [this message]
2017-01-18 18:46 ` [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170109191208.6085-8-fabf@skynet.be \
    --to=fabf@skynet.be \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).