From e2ed6e4daa6f16f088600d98568cb5730b5238a6 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Tue, 7 Oct 2008 18:26:55 +1100 Subject: powerpc/spufs: set nlink count for spufs root correctly Currently, an empty spufs root inode has nlink count of 1. However, the directory has two links; / -> spu and /spu/ -> . This change increments the link count of the root inode in spufs. Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spufs/inode.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/powerpc/platforms/cell') diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 690ca7b0dcf..0d262b9f94a 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -755,6 +755,7 @@ spufs_create_root(struct super_block *sb, void *data) inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; SPUFS_I(inode)->i_ctx = NULL; + inc_nlink(inode); ret = -EINVAL; if (!spufs_parse_options(sb, data, inode)) -- cgit v1.2.3 From ba0b996d01eaca4f3cc1f07dcc238fcad7e0d427 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Thu, 9 Oct 2008 10:39:21 +1100 Subject: powerpc/spufs: use inc_nlink Style change: use inc_nlink instead of incrementing i_nlink directly Signed-off-by: Jeremy Kerr --- arch/powerpc/platforms/cell/spufs/inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/powerpc/platforms/cell') diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 0d262b9f94a..d79ac67c9df 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -298,8 +298,8 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, unsigned int flags, d_instantiate(dentry, inode); dget(dentry); - dir->i_nlink++; - dentry->d_inode->i_nlink++; + inc_nlink(dir); + inc_nlink(dentry->d_inode); goto out; out_free_ctx: @@ -538,8 +538,8 @@ spufs_mkgang(struct inode *dir, struct dentry *dentry, int mode) inode->i_fop = &simple_dir_operations; d_instantiate(dentry, inode); - dir->i_nlink++; - dentry->d_inode->i_nlink++; + inc_nlink(dir); + inc_nlink(dentry->d_inode); return ret; out_iput: -- cgit v1.2.3 From 6747c2ee8abf749e63fee8cd01a9ee293e6a4247 Mon Sep 17 00:00:00 2001 From: Kou Ishizaki Date: Thu, 9 Oct 2008 10:45:49 +1100 Subject: powerpc/spufs: add a missing mutex_unlock A mutex_unlock(&gang->aff_mutex) in spufs_create_context() is missing in case spufs_context_open() fails. As a result, spu_create syscall and spu_get_idle() may block. This patch adds the mutex_unlock. Signed-off-by: Kou Ishizaki Signed-off-by: Jeremy Kerr Acked-by: Andre Detsch --- arch/powerpc/platforms/cell/spufs/inode.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/powerpc/platforms/cell') diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index d79ac67c9df..6b7c7b13245 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -496,6 +496,8 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, ret = spufs_context_open(dget(dentry), mntget(mnt)); if (ret < 0) { WARN_ON(spufs_rmdir(inode, dentry)); + if (affinity) + mutex_unlock(&gang->aff_mutex); mutex_unlock(&inode->i_mutex); spu_forget(SPUFS_I(dentry->d_inode)->i_ctx); goto out; -- cgit v1.2.3