Skip to content

Commit

Permalink
fs/affs: make export work with cold dcache
Browse files Browse the repository at this point in the history
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)

[weiyongjun1@huawei.com: fix return value check in affs_get_parent()]
  Link: http://lkml.kernel.org/r/20170123141018.2331-1-weiyj.lk@gmail.com
Link: http://lkml.kernel.org/r/20170109191208.6085-8-fabf@skynet.be
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Fabian Frederick authored and Linus Torvalds committed Feb 28, 2017
1 parent f567acc commit b3b42c0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions fs/affs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!bh)
return ERR_PTR(-EIO);

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)
{
Expand Down Expand Up @@ -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 = {
Expand Down

0 comments on commit b3b42c0

Please sign in to comment.