2008-11-17 18:58:46

by Kyle McMartin

[permalink] [raw]
Subject: [PATCH squashfs] fix squashfs for d_alloc_anon removal

Signed-off-by: Kyle McMartin <[email protected]>

diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index 0c0173c..335ba3e 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -639,29 +639,14 @@ static struct dentry *squashfs_export_iget(struct super_block *s,
{
squashfs_inode_t inode;
struct inode *i;
- struct dentry *dentry;
+ struct dentry *dentry = ERR_PTR(-ENOENT);

TRACE("Entered squashfs_export_iget\n");

inode = squashfs_inode_lookup(s, inode_number);
- if(inode == SQUASHFS_INVALID_BLK) {
- dentry = ERR_PTR(-ENOENT);
- goto failure;
- }
-
- i = squashfs_iget(s, inode, inode_number);
- if(i == NULL) {
- dentry = ERR_PTR(-EACCES);
- goto failure;
- }
-
- dentry = d_alloc_anon(i);
- if (dentry == NULL) {
- iput(i);
- dentry = ERR_PTR(-ENOMEM);
- }
+ if (inode != SQUASHFS_INVALID_BLK)
+ dentry = d_obtain_alias(squashfs_iget(s, inode, inode_number));

-failure:
return dentry;
}