diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-19 08:23:13 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-29 13:24:13 -0400 |
commit | 25b2692a8ace4c2684d3899a0bfe55f8c4248899 (patch) | |
tree | 9a3a3e59c775aa175731e650e98590ba30330b37 /arch/powerpc | |
parent | 1ba44cc970e40b544af7e76a19285d568b4f3ccc (diff) |
pull unlock+dput() out into do_spu_create()
... and cleaning spufs_create() a bit, while we are at it
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/inode.c | 25 | ||||
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/syscalls.c | 2 |
2 files changed, 11 insertions, 16 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 0576c44aa75c..dba1ce235da5 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -582,39 +582,32 @@ static struct file_system_type spufs_type; | |||
582 | long spufs_create(struct path *path, struct dentry *dentry, | 582 | long spufs_create(struct path *path, struct dentry *dentry, |
583 | unsigned int flags, umode_t mode, struct file *filp) | 583 | unsigned int flags, umode_t mode, struct file *filp) |
584 | { | 584 | { |
585 | struct inode *dir = path->dentry->d_inode; | ||
585 | int ret; | 586 | int ret; |
586 | 587 | ||
587 | ret = -EINVAL; | ||
588 | /* check if we are on spufs */ | 588 | /* check if we are on spufs */ |
589 | if (path->dentry->d_sb->s_type != &spufs_type) | 589 | if (path->dentry->d_sb->s_type != &spufs_type) |
590 | goto out; | 590 | return -EINVAL; |
591 | 591 | ||
592 | /* don't accept undefined flags */ | 592 | /* don't accept undefined flags */ |
593 | if (flags & (~SPU_CREATE_FLAG_ALL)) | 593 | if (flags & (~SPU_CREATE_FLAG_ALL)) |
594 | goto out; | 594 | return -EINVAL; |
595 | 595 | ||
596 | /* only threads can be underneath a gang */ | 596 | /* only threads can be underneath a gang */ |
597 | if (path->dentry != path->dentry->d_sb->s_root) { | 597 | if (path->dentry != path->dentry->d_sb->s_root) |
598 | if ((flags & SPU_CREATE_GANG) || | 598 | if ((flags & SPU_CREATE_GANG) || !SPUFS_I(dir)->i_gang) |
599 | !SPUFS_I(path->dentry->d_inode)->i_gang) | 599 | return -EINVAL; |
600 | goto out; | ||
601 | } | ||
602 | 600 | ||
603 | mode &= ~current_umask(); | 601 | mode &= ~current_umask(); |
604 | 602 | ||
605 | if (flags & SPU_CREATE_GANG) | 603 | if (flags & SPU_CREATE_GANG) |
606 | ret = spufs_create_gang(path->dentry->d_inode, | 604 | ret = spufs_create_gang(dir, dentry, path->mnt, mode); |
607 | dentry, path->mnt, mode); | ||
608 | else | 605 | else |
609 | ret = spufs_create_context(path->dentry->d_inode, | 606 | ret = spufs_create_context(dir, dentry, path->mnt, flags, mode, |
610 | dentry, path->mnt, flags, mode, | ||
611 | filp); | 607 | filp); |
612 | if (ret >= 0) | 608 | if (ret >= 0) |
613 | fsnotify_mkdir(path->dentry->d_inode, dentry); | 609 | fsnotify_mkdir(dir, dentry); |
614 | 610 | ||
615 | out: | ||
616 | mutex_unlock(&path->dentry->d_inode->i_mutex); | ||
617 | dput(dentry); | ||
618 | return ret; | 611 | return ret; |
619 | } | 612 | } |
620 | 613 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c index 5665dcc382c7..8591bb62d7fc 100644 --- a/arch/powerpc/platforms/cell/spufs/syscalls.c +++ b/arch/powerpc/platforms/cell/spufs/syscalls.c | |||
@@ -70,6 +70,8 @@ static long do_spu_create(const char __user *pathname, unsigned int flags, | |||
70 | ret = PTR_ERR(dentry); | 70 | ret = PTR_ERR(dentry); |
71 | if (!IS_ERR(dentry)) { | 71 | if (!IS_ERR(dentry)) { |
72 | ret = spufs_create(&path, dentry, flags, mode, neighbor); | 72 | ret = spufs_create(&path, dentry, flags, mode, neighbor); |
73 | mutex_unlock(&path.dentry->d_inode->i_mutex); | ||
74 | dput(dentry); | ||
73 | path_put(&path); | 75 | path_put(&path); |
74 | } | 76 | } |
75 | 77 | ||