namei: minor vfs_unlink cleanup
We'll be using dentry->d_inode in one more place. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
df4e8d2c1d
commit
9accbb977a
|
@ -3617,6 +3617,7 @@ SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
|
||||||
|
|
||||||
int vfs_unlink(struct inode *dir, struct dentry *dentry)
|
int vfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
{
|
{
|
||||||
|
struct inode *target = dentry->d_inode;
|
||||||
int error = may_delete(dir, dentry, 0);
|
int error = may_delete(dir, dentry, 0);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
|
@ -3625,7 +3626,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
if (!dir->i_op->unlink)
|
if (!dir->i_op->unlink)
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
|
|
||||||
mutex_lock(&dentry->d_inode->i_mutex);
|
mutex_lock(&target->i_mutex);
|
||||||
if (d_mountpoint(dentry))
|
if (d_mountpoint(dentry))
|
||||||
error = -EBUSY;
|
error = -EBUSY;
|
||||||
else {
|
else {
|
||||||
|
@ -3636,11 +3637,11 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
dont_mount(dentry);
|
dont_mount(dentry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
mutex_unlock(&target->i_mutex);
|
||||||
|
|
||||||
/* We don't d_delete() NFS sillyrenamed files--they still exist. */
|
/* We don't d_delete() NFS sillyrenamed files--they still exist. */
|
||||||
if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
|
if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) {
|
||||||
fsnotify_link_count(dentry->d_inode);
|
fsnotify_link_count(target);
|
||||||
d_delete(dentry);
|
d_delete(dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue