From: Ryusuke Konishi Date: Fri, 20 Aug 2010 14:46:06 +0000 (+0900) Subject: nilfs2: allow nilfs_destroy_inode to destroy metadata file inodes X-Git-Tag: v2.6.37-rc1~150^2~34 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b91c9a97c9333c87fe2a0c94b3b22b24df1c5fc2;p=profile%2Fivi%2Fkernel-x86-ivi.git 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 --- diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index d01aff4..ee943a3 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c @@ -577,7 +577,5 @@ void nilfs_mdt_destroy(struct inode *inode) nilfs_palloc_destroy_cache(inode); nilfs_mdt_clear(inode); - kfree(mdi->mi_bgl); /* kfree(NULL) is safe */ - kfree(mdi); nilfs_destroy_inode(inode); } diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 9f4913f..51576b4 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c @@ -167,6 +167,12 @@ struct inode *nilfs_alloc_inode(struct super_block *sb) void nilfs_destroy_inode(struct inode *inode) { + struct nilfs_mdt_info *mdi = NILFS_MDT(inode); + + if (mdi) { + kfree(mdi->mi_bgl); /* kfree(NULL) is safe */ + kfree(mdi); + } kmem_cache_free(nilfs_inode_cachep, NILFS_I(inode)); }