diff options
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r-- | net/sunrpc/rpc_pipe.c | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index a3bd2db2e024..0b1a1ac8a4bc 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -539,6 +539,7 @@ repeat: | |||
539 | rpc_close_pipes(dentry->d_inode); | 539 | rpc_close_pipes(dentry->d_inode); |
540 | simple_unlink(dir, dentry); | 540 | simple_unlink(dir, dentry); |
541 | } | 541 | } |
542 | inode_dir_notify(dir, DN_DELETE); | ||
542 | dput(dentry); | 543 | dput(dentry); |
543 | } while (n); | 544 | } while (n); |
544 | goto repeat; | 545 | goto repeat; |
@@ -610,8 +611,8 @@ __rpc_rmdir(struct inode *dir, struct dentry *dentry) | |||
610 | int error; | 611 | int error; |
611 | 612 | ||
612 | shrink_dcache_parent(dentry); | 613 | shrink_dcache_parent(dentry); |
613 | if (dentry->d_inode) | 614 | if (d_unhashed(dentry)) |
614 | rpc_close_pipes(dentry->d_inode); | 615 | return 0; |
615 | if ((error = simple_rmdir(dir, dentry)) != 0) | 616 | if ((error = simple_rmdir(dir, dentry)) != 0) |
616 | return error; | 617 | return error; |
617 | if (!error) { | 618 | if (!error) { |
@@ -684,28 +685,20 @@ err_dput: | |||
684 | } | 685 | } |
685 | 686 | ||
686 | int | 687 | int |
687 | rpc_rmdir(char *path) | 688 | rpc_rmdir(struct dentry *dentry) |
688 | { | 689 | { |
689 | struct nameidata nd; | 690 | struct dentry *parent; |
690 | struct dentry *dentry; | ||
691 | struct inode *dir; | 691 | struct inode *dir; |
692 | int error; | 692 | int error; |
693 | 693 | ||
694 | if ((error = rpc_lookup_parent(path, &nd)) != 0) | 694 | parent = dget_parent(dentry); |
695 | return error; | 695 | dir = parent->d_inode; |
696 | dir = nd.dentry->d_inode; | ||
697 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 696 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
698 | dentry = lookup_one_len(nd.last.name, nd.dentry, nd.last.len); | ||
699 | if (IS_ERR(dentry)) { | ||
700 | error = PTR_ERR(dentry); | ||
701 | goto out_release; | ||
702 | } | ||
703 | rpc_depopulate(dentry); | 697 | rpc_depopulate(dentry); |
704 | error = __rpc_rmdir(dir, dentry); | 698 | error = __rpc_rmdir(dir, dentry); |
705 | dput(dentry); | 699 | dput(dentry); |
706 | out_release: | ||
707 | mutex_unlock(&dir->i_mutex); | 700 | mutex_unlock(&dir->i_mutex); |
708 | rpc_release_path(&nd); | 701 | dput(parent); |
709 | return error; | 702 | return error; |
710 | } | 703 | } |
711 | 704 | ||
@@ -746,32 +739,26 @@ err_dput: | |||
746 | } | 739 | } |
747 | 740 | ||
748 | int | 741 | int |
749 | rpc_unlink(char *path) | 742 | rpc_unlink(struct dentry *dentry) |
750 | { | 743 | { |
751 | struct nameidata nd; | 744 | struct dentry *parent; |
752 | struct dentry *dentry; | ||
753 | struct inode *dir; | 745 | struct inode *dir; |
754 | int error; | 746 | int error = 0; |
755 | 747 | ||
756 | if ((error = rpc_lookup_parent(path, &nd)) != 0) | 748 | parent = dget_parent(dentry); |
757 | return error; | 749 | dir = parent->d_inode; |
758 | dir = nd.dentry->d_inode; | ||
759 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); | 750 | mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); |
760 | dentry = lookup_one_len(nd.last.name, nd.dentry, nd.last.len); | 751 | if (!d_unhashed(dentry)) { |
761 | if (IS_ERR(dentry)) { | 752 | d_drop(dentry); |
762 | error = PTR_ERR(dentry); | 753 | if (dentry->d_inode) { |
763 | goto out_release; | 754 | rpc_close_pipes(dentry->d_inode); |
764 | } | 755 | error = simple_unlink(dir, dentry); |
765 | d_drop(dentry); | 756 | } |
766 | if (dentry->d_inode) { | 757 | inode_dir_notify(dir, DN_DELETE); |
767 | rpc_close_pipes(dentry->d_inode); | ||
768 | error = simple_unlink(dir, dentry); | ||
769 | } | 758 | } |
770 | dput(dentry); | 759 | dput(dentry); |
771 | inode_dir_notify(dir, DN_DELETE); | ||
772 | out_release: | ||
773 | mutex_unlock(&dir->i_mutex); | 760 | mutex_unlock(&dir->i_mutex); |
774 | rpc_release_path(&nd); | 761 | dput(parent); |
775 | return error; | 762 | return error; |
776 | } | 763 | } |
777 | 764 | ||