diff options
author | J. Bruce Fields <bfields@redhat.com> | 2012-08-28 07:03:24 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-11-09 00:16:41 -0500 |
commit | 9accbb977ab78234b8f298df5f306ed08d06bedb (patch) | |
tree | 550c1267fb53fa74cb72520033c171ce7912de54 /fs/namei.c | |
parent | df4e8d2c1d2bbbbace706bfe5417320c9e3fbee3 (diff) |
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>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/namei.c b/fs/namei.c index 88cec0330bf7..e633a58d4222 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -3617,6 +3617,7 @@ SYSCALL_DEFINE1(rmdir, const char __user *, pathname) | |||
3617 | 3617 | ||
3618 | int vfs_unlink(struct inode *dir, struct dentry *dentry) | 3618 | int vfs_unlink(struct inode *dir, struct dentry *dentry) |
3619 | { | 3619 | { |
3620 | struct inode *target = dentry->d_inode; | ||
3620 | int error = may_delete(dir, dentry, 0); | 3621 | int error = may_delete(dir, dentry, 0); |
3621 | 3622 | ||
3622 | if (error) | 3623 | if (error) |
@@ -3625,7 +3626,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) | |||
3625 | if (!dir->i_op->unlink) | 3626 | if (!dir->i_op->unlink) |
3626 | return -EPERM; | 3627 | return -EPERM; |
3627 | 3628 | ||
3628 | mutex_lock(&dentry->d_inode->i_mutex); | 3629 | mutex_lock(&target->i_mutex); |
3629 | if (d_mountpoint(dentry)) | 3630 | if (d_mountpoint(dentry)) |
3630 | error = -EBUSY; | 3631 | error = -EBUSY; |
3631 | else { | 3632 | else { |
@@ -3636,11 +3637,11 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry) | |||
3636 | dont_mount(dentry); | 3637 | dont_mount(dentry); |
3637 | } | 3638 | } |
3638 | } | 3639 | } |
3639 | mutex_unlock(&dentry->d_inode->i_mutex); | 3640 | mutex_unlock(&target->i_mutex); |
3640 | 3641 | ||
3641 | /* We don't d_delete() NFS sillyrenamed files--they still exist. */ | 3642 | /* We don't d_delete() NFS sillyrenamed files--they still exist. */ |
3642 | if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { | 3643 | if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { |
3643 | fsnotify_link_count(dentry->d_inode); | 3644 | fsnotify_link_count(target); |
3644 | d_delete(dentry); | 3645 | d_delete(dentry); |
3645 | } | 3646 | } |
3646 | 3647 | ||