aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/rpc_pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/rpc_pipe.c')
-rw-r--r--net/sunrpc/rpc_pipe.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index a3bd2db2e024..9144f2767b66 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -746,22 +746,15 @@ err_dput:
746} 746}
747 747
748int 748int
749rpc_unlink(char *path) 749rpc_unlink(struct dentry *dentry)
750{ 750{
751 struct nameidata nd; 751 struct dentry *parent;
752 struct dentry *dentry;
753 struct inode *dir; 752 struct inode *dir;
754 int error; 753 int error = 0;
755 754
756 if ((error = rpc_lookup_parent(path, &nd)) != 0) 755 parent = dget_parent(dentry);
757 return error; 756 dir = parent->d_inode;
758 dir = nd.dentry->d_inode;
759 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT); 757 mutex_lock_nested(&dir->i_mutex, I_MUTEX_PARENT);
760 dentry = lookup_one_len(nd.last.name, nd.dentry, nd.last.len);
761 if (IS_ERR(dentry)) {
762 error = PTR_ERR(dentry);
763 goto out_release;
764 }
765 d_drop(dentry); 758 d_drop(dentry);
766 if (dentry->d_inode) { 759 if (dentry->d_inode) {
767 rpc_close_pipes(dentry->d_inode); 760 rpc_close_pipes(dentry->d_inode);
@@ -769,9 +762,8 @@ rpc_unlink(char *path)
769 } 762 }
770 dput(dentry); 763 dput(dentry);
771 inode_dir_notify(dir, DN_DELETE); 764 inode_dir_notify(dir, DN_DELETE);
772out_release:
773 mutex_unlock(&dir->i_mutex); 765 mutex_unlock(&dir->i_mutex);
774 rpc_release_path(&nd); 766 dput(parent);
775 return error; 767 return error;
776} 768}
777 769