summaryrefslogtreecommitdiffstats
path: root/fs/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-03-03 14:12:08 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2010-03-03 14:12:08 -0500
commitbec1052e5be6a70f03f6adc650f3a6e4c2f44ddf (patch)
treee73e73b59d5b8c87f7cc50b0e17a89eaa0e704dc /fs/namei.c
parentdb1f05bb85d7966b9176e293f3ceead1cb8b5d79 (diff)
set S_DEAD on unlink() and non-directory rename() victims
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 3df2ed50ab5..54d33df06be 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -2262,8 +2262,11 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
error = -EBUSY;
else {
error = security_inode_unlink(dir, dentry);
- if (!error)
+ if (!error) {
error = dir->i_op->unlink(dir, dentry);
+ if (!error)
+ dentry->d_inode->i_flags |= S_DEAD;
+ }
}
mutex_unlock(&dentry->d_inode->i_mutex);
@@ -2616,6 +2619,8 @@ static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
else
error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
if (!error) {
+ if (target)
+ target->i_flags |= S_DEAD;
if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE))
d_move(old_dentry, new_dentry);
}