Skip to content

Commit

Permalink
jffs2: fix IN_DELETE_SELF on overwriting rename() killing a directory
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Al Viro committed Jul 22, 2011
1 parent 841590c commit 22ba747
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/jffs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,10 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,

if (victim_f) {
/* There was a victim. Kill it off nicely */
drop_nlink(new_dentry->d_inode);
if (S_ISDIR(new_dentry->d_inode->i_mode))
clear_nlink(new_dentry->d_inode);
else
drop_nlink(new_dentry->d_inode);
/* Don't oops if the victim was a dirent pointing to an
inode which didn't exist. */
if (victim_f->inocache) {
Expand Down

0 comments on commit 22ba747

Please sign in to comment.