diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-21 15:57:47 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-22 19:42:11 -0400 |
commit | 22ba747f660c0acd14761628c24aa972d18058a0 (patch) | |
tree | 8a96b344623ba66c3138bd4d6cc916f5ad3d3053 /fs/jffs2 | |
parent | 841590ce16c19a3ce38028adfc8b1955482ee00c (diff) |
jffs2: fix IN_DELETE_SELF on overwriting rename() killing a directory
We don't generate IN_DELETE_SELF on victim of overwriting rename() if
it happens to be a directory. Trivially fixed by doing to ->i_nlink
what we do ->pino_nlink a couple of lines later in jffs2_rename().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/dir.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 8f40ce4f1777..5f243cd63afc 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -820,7 +820,10 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, | |||
820 | 820 | ||
821 | if (victim_f) { | 821 | if (victim_f) { |
822 | /* There was a victim. Kill it off nicely */ | 822 | /* There was a victim. Kill it off nicely */ |
823 | drop_nlink(new_dentry->d_inode); | 823 | if (S_ISDIR(new_dentry->d_inode->i_mode)) |
824 | clear_nlink(new_dentry->d_inode); | ||
825 | else | ||
826 | drop_nlink(new_dentry->d_inode); | ||
824 | /* Don't oops if the victim was a dirent pointing to an | 827 | /* Don't oops if the victim was a dirent pointing to an |
825 | inode which didn't exist. */ | 828 | inode which didn't exist. */ |
826 | if (victim_f->inocache) { | 829 | if (victim_f->inocache) { |