Skip to content

Commit

Permalink
UBIFS: free budget in delete_inode as well
Browse files Browse the repository at this point in the history
Although the inode is marked as clean when it is being deleted,
it might stay and be used as orphan, and be marked as dirty.
So we have to free the budget when we delete it.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
  • Loading branch information
Artem Bityutskiy authored and Artem Bityutskiy committed Aug 13, 2008
1 parent 7d32c2b commit 1e0f358
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/ubifs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,9 @@ static void ubifs_delete_inode(struct inode *inode)
{
int err;
struct ubifs_info *c = inode->i_sb->s_fs_info;
struct ubifs_inode *ui = ubifs_inode(inode);

if (ubifs_inode(inode)->xattr)
if (ui->xattr)
/*
* Extended attribute inode deletions are fully handled in
* 'ubifs_removexattr()'. These inodes are special and have
Expand All @@ -326,13 +327,12 @@ static void ubifs_delete_inode(struct inode *inode)
dbg_gen("inode %lu, mode %#x", inode->i_ino, (int)inode->i_mode);
ubifs_assert(!atomic_read(&inode->i_count));
ubifs_assert(inode->i_nlink == 0);
ubifs_assert(!ubifs_inode(inode)->dirty);

truncate_inode_pages(&inode->i_data, 0);
if (is_bad_inode(inode))
goto out;

ubifs_inode(inode)->ui_size = inode->i_size = 0;
ui->ui_size = inode->i_size = 0;
err = ubifs_jnl_write_inode(c, inode, 1);
if (err)
/*
Expand All @@ -341,6 +341,8 @@ static void ubifs_delete_inode(struct inode *inode)
*/
ubifs_err("can't write inode %lu, error %d", inode->i_ino, err);
out:
if (ui->dirty)
ubifs_release_dirty_inode_budget(c, ui);
clear_inode(inode);
}

Expand Down

0 comments on commit 1e0f358

Please sign in to comment.