Skip to content

Commit b91c9a9

Browse files
committed
nilfs2: allow nilfs_destroy_inode to destroy metadata file inodes
The current nilfs_destroy_inode() doesn't handle metadata file inodes including gc inodes (dummy inodes used for garbage collection). This allows nilfs_destroy_inode() to destroy inodes of metadata files. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
1 parent 9566a7a commit b91c9a9

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎fs/nilfs2/mdt.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,5 @@ void nilfs_mdt_destroy(struct inode *inode)
577577
nilfs_palloc_destroy_cache(inode);
578578
nilfs_mdt_clear(inode);
579579

580-
kfree(mdi->mi_bgl); /* kfree(NULL) is safe */
581-
kfree(mdi);
582580
nilfs_destroy_inode(inode);
583581
}

‎fs/nilfs2/super.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ struct inode *nilfs_alloc_inode(struct super_block *sb)
167167

168168
void nilfs_destroy_inode(struct inode *inode)
169169
{
170+
struct nilfs_mdt_info *mdi = NILFS_MDT(inode);
171+
172+
if (mdi) {
173+
kfree(mdi->mi_bgl); /* kfree(NULL) is safe */
174+
kfree(mdi);
175+
}
170176
kmem_cache_free(nilfs_inode_cachep, NILFS_I(inode));
171177
}
172178

0 commit comments

Comments
 (0)