mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
set S_DEAD on unlink() and non-directory rename() victims
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
db1f05bb85
commit
bec1052e5b
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user