Skip to content

Commit b3b42c0

Browse files
Fabian Fredericktorvalds
Fabian Frederick
authored andcommitted
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) [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>
1 parent f567acc commit b3b42c0

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

fs/affs/namei.c

+19
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,24 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
447447
return retval;
448448
}
449449

450+
static struct dentry *affs_get_parent(struct dentry *child)
451+
{
452+
struct inode *parent;
453+
struct buffer_head *bh;
454+
455+
bh = affs_bread(child->d_sb, d_inode(child)->i_ino);
456+
if (!bh)
457+
return ERR_PTR(-EIO);
458+
459+
parent = affs_iget(child->d_sb,
460+
be32_to_cpu(AFFS_TAIL(child->d_sb, bh)->parent));
461+
brelse(bh);
462+
if (IS_ERR(parent))
463+
return ERR_CAST(parent);
464+
465+
return d_obtain_alias(parent);
466+
}
467+
450468
static struct inode *affs_nfs_get_inode(struct super_block *sb, u64 ino,
451469
u32 generation)
452470
{
@@ -484,6 +502,7 @@ static struct dentry *affs_fh_to_parent(struct super_block *sb, struct fid *fid,
484502
const struct export_operations affs_export_ops = {
485503
.fh_to_dentry = affs_fh_to_dentry,
486504
.fh_to_parent = affs_fh_to_parent,
505+
.get_parent = affs_get_parent,
487506
};
488507

489508
const struct dentry_operations affs_dentry_operations = {

0 commit comments

Comments
 (0)