Shen Feng
2009-Jan-07 06:56 UTC
[PATCH] Btrfs: check inode allocaton earlier in btrfs_fill_super
Just after it''s allocation. Signed-off-by: Shen Feng <shen@cn.fujitsu.com> --- fs/btrfs/super.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index b4c101d..4c31c4f 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -322,6 +322,11 @@ static int btrfs_fill_super(struct super_block *sb, disk_super = &tree_root->fs_info->super_copy; inode = btrfs_iget_locked(sb, BTRFS_FIRST_FREE_OBJECTID, tree_root->fs_info->fs_root); + if (!inode) { + err = -ENOMEM; + goto fail_close; + } + bi = BTRFS_I(inode); bi->location.objectid = inode->i_ino; bi->location.offset = 0; @@ -329,10 +334,6 @@ static int btrfs_fill_super(struct super_block *sb, btrfs_set_key_type(&bi->location, BTRFS_INODE_ITEM_KEY); - if (!inode) { - err = -ENOMEM; - goto fail_close; - } if (inode->i_state & I_NEW) { btrfs_read_locked_inode(inode); unlock_new_inode(inode); -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html