+struct dentry *efs_get_parent(struct dentry *child)
+{
+ struct dentry *parent;
+ struct inode *inode;
+ efs_ino_t ino;
+ int error;
+
+ lock_kernel();
+
+ error = -ENOENT;
+ ino = efs_find_entry(child->d_inode, "..", 2);
+ if (!ino)
+ goto fail;
+
+ error = -EACCES;
+ inode = iget(child->d_inode->i_sb, ino);
+ if (!inode)
+ goto fail;
+
+ error = -ENOMEM;
+ parent = d_alloc_anon(inode);
+ if (!parent)
+ goto fail_iput;
+
+ unlock_kernel();
+ return parent;
+
+ fail_iput:
+ iput(inode);
+ fail:
+ unlock_kernel();
+ return ERR_PTR(error);
+}