diff options
author | Fabian Frederick <fabf@skynet.be> | 2017-02-08 10:28:20 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2017-02-09 07:39:06 +1100 |
commit | fadac18996ec6ec9765af52fa924488706040716 (patch) | |
tree | 69dd6b20add010bcb089e56e8555d90ba01f5726 /fs | |
parent | 8022ce6550e40eb08fe32d180a778172c4ba4fe2 (diff) |
fs/affs: make export work with cold dcache
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)
Link: http://lkml.kernel.org/r/20170109191208.6085-8-fabf@skynet.be
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Suggested-by: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/affs/namei.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index fb88446bafef..a3df8a682a35 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c @@ -447,6 +447,24 @@ done: 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 = { |