aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r--fs/fuse/inode.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 54b1f0e1ef58..2e99f34b4435 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -596,12 +596,8 @@ static struct dentry *fuse_get_dentry(struct super_block *sb,
596 if (inode->i_generation != handle->generation) 596 if (inode->i_generation != handle->generation)
597 goto out_iput; 597 goto out_iput;
598 598
599 entry = d_alloc_anon(inode); 599 entry = d_obtain_alias(inode);
600 err = -ENOMEM; 600 if (!IS_ERR(entry) && get_node_id(inode) != FUSE_ROOT_ID) {
601 if (!entry)
602 goto out_iput;
603
604 if (get_node_id(inode) != FUSE_ROOT_ID) {
605 entry->d_op = &fuse_dentry_operations; 601 entry->d_op = &fuse_dentry_operations;
606 fuse_invalidate_entry_cache(entry); 602 fuse_invalidate_entry_cache(entry);
607 } 603 }
@@ -696,17 +692,14 @@ static struct dentry *fuse_get_parent(struct dentry *child)
696 name.name = ".."; 692 name.name = "..";
697 err = fuse_lookup_name(child_inode->i_sb, get_node_id(child_inode), 693 err = fuse_lookup_name(child_inode->i_sb, get_node_id(child_inode),
698 &name, &outarg, &inode); 694 &name, &outarg, &inode);
699 if (err && err != -ENOENT) 695 if (err) {
696 if (err == -ENOENT)
697 return ERR_PTR(-ESTALE);
700 return ERR_PTR(err); 698 return ERR_PTR(err);
701 if (err || !inode)
702 return ERR_PTR(-ESTALE);
703
704 parent = d_alloc_anon(inode);
705 if (!parent) {
706 iput(inode);
707 return ERR_PTR(-ENOMEM);
708 } 699 }
709 if (get_node_id(inode) != FUSE_ROOT_ID) { 700
701 parent = d_obtain_alias(inode);
702 if (!IS_ERR(parent) && get_node_id(inode) != FUSE_ROOT_ID) {
710 parent->d_op = &fuse_dentry_operations; 703 parent->d_op = &fuse_dentry_operations;
711 fuse_invalidate_entry_cache(parent); 704 fuse_invalidate_entry_cache(parent);
712 } 705 }