diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-25 03:46:13 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-22 16:01:17 -0400 |
commit | bf349a447059656ebe63fb4fd1ccb27ac1da22ad (patch) | |
tree | e9704ee3c1509c49f3fadbb781d0cbd3ac0e9d4b | |
parent | 3b6456d2c3fc9d0c4ec1db5d6594f40098ff0a6f (diff) |
spufs: shift dget/mntget towards dentry_open()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/powerpc/platforms/cell/spufs/inode.c | 46 |
1 files changed, 18 insertions, 28 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 66519d263da7..1c9cac0cf895 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -323,22 +323,21 @@ static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt) | |||
323 | struct file *filp; | 323 | struct file *filp; |
324 | 324 | ||
325 | ret = get_unused_fd(); | 325 | ret = get_unused_fd(); |
326 | if (ret < 0) { | 326 | if (ret < 0) |
327 | dput(dentry); | 327 | return ret; |
328 | mntput(mnt); | ||
329 | goto out; | ||
330 | } | ||
331 | 328 | ||
332 | filp = dentry_open(dentry, mnt, O_RDONLY, current_cred()); | 329 | /* |
330 | * get references for dget and mntget, will be released | ||
331 | * in error path of *_open(). | ||
332 | */ | ||
333 | filp = dentry_open(dget(dentry), mntget(mnt), O_RDONLY, current_cred()); | ||
333 | if (IS_ERR(filp)) { | 334 | if (IS_ERR(filp)) { |
334 | put_unused_fd(ret); | 335 | put_unused_fd(ret); |
335 | ret = PTR_ERR(filp); | 336 | return PTR_ERR(filp); |
336 | goto out; | ||
337 | } | 337 | } |
338 | 338 | ||
339 | filp->f_op = &spufs_context_fops; | 339 | filp->f_op = &spufs_context_fops; |
340 | fd_install(ret, filp); | 340 | fd_install(ret, filp); |
341 | out: | ||
342 | return ret; | 341 | return ret; |
343 | } | 342 | } |
344 | 343 | ||
@@ -495,11 +494,7 @@ spufs_create_context(struct inode *inode, struct dentry *dentry, | |||
495 | put_spu_context(neighbor); | 494 | put_spu_context(neighbor); |
496 | } | 495 | } |
497 | 496 | ||
498 | /* | 497 | ret = spufs_context_open(dentry, mnt); |
499 | * get references for dget and mntget, will be released | ||
500 | * in error path of *_open(). | ||
501 | */ | ||
502 | ret = spufs_context_open(dget(dentry), mntget(mnt)); | ||
503 | if (ret < 0) { | 498 | if (ret < 0) { |
504 | WARN_ON(spufs_rmdir(inode, dentry)); | 499 | WARN_ON(spufs_rmdir(inode, dentry)); |
505 | if (affinity) | 500 | if (affinity) |
@@ -562,22 +557,21 @@ static int spufs_gang_open(struct dentry *dentry, struct vfsmount *mnt) | |||
562 | struct file *filp; | 557 | struct file *filp; |
563 | 558 | ||
564 | ret = get_unused_fd(); | 559 | ret = get_unused_fd(); |
565 | if (ret < 0) { | 560 | if (ret < 0) |
566 | dput(dentry); | 561 | return ret; |
567 | mntput(mnt); | ||
568 | goto out; | ||
569 | } | ||
570 | 562 | ||
571 | filp = dentry_open(dentry, mnt, O_RDONLY, current_cred()); | 563 | /* |
564 | * get references for dget and mntget, will be released | ||
565 | * in error path of *_open(). | ||
566 | */ | ||
567 | filp = dentry_open(dget(dentry), mntget(mnt), O_RDONLY, current_cred()); | ||
572 | if (IS_ERR(filp)) { | 568 | if (IS_ERR(filp)) { |
573 | put_unused_fd(ret); | 569 | put_unused_fd(ret); |
574 | ret = PTR_ERR(filp); | 570 | return PTR_ERR(filp); |
575 | goto out; | ||
576 | } | 571 | } |
577 | 572 | ||
578 | filp->f_op = &simple_dir_operations; | 573 | filp->f_op = &simple_dir_operations; |
579 | fd_install(ret, filp); | 574 | fd_install(ret, filp); |
580 | out: | ||
581 | return ret; | 575 | return ret; |
582 | } | 576 | } |
583 | 577 | ||
@@ -591,11 +585,7 @@ static int spufs_create_gang(struct inode *inode, | |||
591 | if (ret) | 585 | if (ret) |
592 | goto out; | 586 | goto out; |
593 | 587 | ||
594 | /* | 588 | ret = spufs_gang_open(dentry, mnt); |
595 | * get references for dget and mntget, will be released | ||
596 | * in error path of *_open(). | ||
597 | */ | ||
598 | ret = spufs_gang_open(dget(dentry), mntget(mnt)); | ||
599 | if (ret < 0) { | 589 | if (ret < 0) { |
600 | int err = simple_rmdir(inode, dentry); | 590 | int err = simple_rmdir(inode, dentry); |
601 | WARN_ON(err); | 591 | WARN_ON(err); |