Skip to content

Commit

Permalink
nilfs2: decrement inodes count only if raw inode was successfully del…
Browse files Browse the repository at this point in the history
…eted

This fixes the issue that inodes count will not add up after removal
of raw inodes fails.  Hence, this prevents possible under flow of the
inodes count.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
  • Loading branch information
Ryusuke Konishi committed Mar 8, 2011
1 parent a5abba9 commit 25b18d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/nilfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ void nilfs_evict_inode(struct inode *inode)
struct nilfs_transaction_info ti;
struct super_block *sb = inode->i_sb;
struct nilfs_inode_info *ii = NILFS_I(inode);
int ret;

if (inode->i_nlink || !ii->i_root || unlikely(is_bad_inode(inode))) {
if (inode->i_data.nrpages)
Expand All @@ -725,8 +726,9 @@ void nilfs_evict_inode(struct inode *inode)
nilfs_mark_inode_dirty(inode);
end_writeback(inode);

nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino);
atomic_dec(&ii->i_root->inodes_count);
ret = nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino);
if (!ret)
atomic_dec(&ii->i_root->inodes_count);

nilfs_clear_inode(inode);

Expand Down

0 comments on commit 25b18d3

Please sign in to comment.