[patch 1/2] spufs: make dentry reference count and locking symmetric

From: jblunck
Date: Tue May 05 2009 - 17:46:55 EST


This patch moves the dput() and the parent inode locking to the same function.

Signed-off-by: Jan Blunck <jblunck@xxxxxxx>
---
arch/powerpc/platforms/cell/spufs/inode.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)

Index: b/arch/powerpc/platforms/cell/spufs/inode.c
===================================================================
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -450,16 +450,16 @@ spufs_create_context(struct inode *inode
ret = -EPERM;
if ((flags & SPU_CREATE_NOSCHED) &&
!capable(CAP_SYS_NICE))
- goto out_unlock;
+ goto out;

ret = -EINVAL;
if ((flags & (SPU_CREATE_NOSCHED | SPU_CREATE_ISOLATE))
== SPU_CREATE_ISOLATE)
- goto out_unlock;
+ goto out;

ret = -ENODEV;
if ((flags & SPU_CREATE_ISOLATE) && !isolated_loader)
- goto out_unlock;
+ goto out;

gang = NULL;
neighbor = NULL;
@@ -468,7 +468,7 @@ spufs_create_context(struct inode *inode
gang = SPUFS_I(inode)->i_gang;
ret = -EINVAL;
if (!gang)
- goto out_unlock;
+ goto out;
mutex_lock(&gang->aff_mutex);
neighbor = spufs_assert_affinity(flags, gang, aff_filp);
if (IS_ERR(neighbor)) {
@@ -505,10 +505,7 @@ spufs_create_context(struct inode *inode
out_aff_unlock:
if (affinity)
mutex_unlock(&gang->aff_mutex);
-out_unlock:
- mutex_unlock(&inode->i_mutex);
out:
- dput(dentry);
return ret;
}

@@ -595,8 +592,6 @@ static int spufs_create_gang(struct inod
}

out:
- mutex_unlock(&inode->i_mutex);
- dput(dentry);
return ret;
}

@@ -645,7 +640,6 @@ long spufs_create(struct nameidata *nd,
filp);
if (ret >= 0)
fsnotify_mkdir(nd->path.dentry->d_inode, dentry);
- return ret;

out_dput:
dput(dentry);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/