Commit 25b18d39 authored by Ryusuke Konishi's avatar Ryusuke Konishi

nilfs2: decrement inodes count only if raw inode was successfully deleted

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: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
parent a5abba98
...@@ -707,6 +707,7 @@ void nilfs_evict_inode(struct inode *inode) ...@@ -707,6 +707,7 @@ void nilfs_evict_inode(struct inode *inode)
struct nilfs_transaction_info ti; struct nilfs_transaction_info ti;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct nilfs_inode_info *ii = NILFS_I(inode); 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_nlink || !ii->i_root || unlikely(is_bad_inode(inode))) {
if (inode->i_data.nrpages) if (inode->i_data.nrpages)
...@@ -725,8 +726,9 @@ void nilfs_evict_inode(struct inode *inode) ...@@ -725,8 +726,9 @@ void nilfs_evict_inode(struct inode *inode)
nilfs_mark_inode_dirty(inode); nilfs_mark_inode_dirty(inode);
end_writeback(inode); end_writeback(inode);
nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino); ret = nilfs_ifile_delete_inode(ii->i_root->ifile, inode->i_ino);
atomic_dec(&ii->i_root->inodes_count); if (!ret)
atomic_dec(&ii->i_root->inodes_count);
nilfs_clear_inode(inode); nilfs_clear_inode(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment