Commit 4872eacc authored by Linus Torvalds's avatar Linus Torvalds

Merge

parents 4161a75e 17191a2c
......@@ -1593,16 +1593,13 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
down(&dentry->d_inode->i_sem);
if (d_mountpoint(dentry))
error = -EBUSY;
else {
else
error = dir->i_op->unlink(dir, dentry);
if (!error)
d_delete(dentry);
}
up(&dentry->d_inode->i_sem);
if (!error)
if (!error) {
d_delete(dentry);
inode_dir_notify(dir, DN_DELETE);
}
return error;
}
......
......@@ -772,10 +772,6 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
dentry->d_parent->d_name.name, dentry->d_name.name,
atomic_read(&dentry->d_count));
if (atomic_read(&dentry->d_count) == 1)
goto out; /* No need to silly rename. */
#ifdef NFS_PARANOIA
if (!dentry->d_inode)
printk("NFS: silly-renaming %s/%s, negative dentry??\n",
......@@ -842,26 +838,10 @@ static int nfs_safe_remove(struct dentry *dentry)
dfprintk(VFS, "NFS: safe_remove(%s/%s)\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
/*
* Unhash the dentry while we remove the file ...
*/
if (!d_unhashed(dentry)) {
d_drop(dentry);
rehash = 1;
}
if (atomic_read(&dentry->d_count) > 1) {
#ifdef NFS_PARANOIA
printk("nfs_safe_remove: %s/%s busy, d_count=%d\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
atomic_read(&dentry->d_count));
#endif
goto out;
}
/* If the dentry was sillyrenamed, we simply call d_delete() */
if (dentry->d_flags & DCACHE_NFSFS_RENAMED) {
error = 0;
goto out_delete;
goto out;
}
nfs_zap_caches(dir);
......@@ -872,15 +852,7 @@ static int nfs_safe_remove(struct dentry *dentry)
goto out;
if (inode)
inode->i_nlink--;
out_delete:
/*
* Free the inode
*/
d_delete(dentry);
out:
if (rehash)
d_rehash(dentry);
return error;
}
......@@ -892,18 +864,29 @@ static int nfs_safe_remove(struct dentry *dentry)
static int nfs_unlink(struct inode *dir, struct dentry *dentry)
{
int error;
int need_rehash = 0;
dfprintk(VFS, "NFS: unlink(%s/%ld, %s)\n", dir->i_sb->s_id,
dir->i_ino, dentry->d_name.name);
lock_kernel();
spin_lock(&dcache_lock);
if (atomic_read(&dentry->d_count) > 1) {
spin_unlock(&dcache_lock);
error = nfs_sillyrename(dir, dentry);
if (error && error != -EBUSY) {
error = nfs_safe_remove(dentry);
if (!error) {
nfs_renew_times(dentry);
unlock_kernel();
return error;
}
if (!d_unhashed(dentry)) {
d_drop(dentry);
need_rehash = 1;
}
spin_unlock(&dcache_lock);
error = nfs_safe_remove(dentry);
if (!error)
nfs_renew_times(dentry);
else if (need_rehash)
d_rehash(dentry);
unlock_kernel();
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment