Merge branch 'akpm' (patches from Andrew Morton)
[cascardo/linux.git] / fs / ocfs2 / refcounttree.c
index 0022192..55767e1 100644 (file)
@@ -612,6 +612,11 @@ static int ocfs2_create_refcount_tree(struct inode *inode,
        }
 
        new_bh = sb_getblk(inode->i_sb, first_blkno);
+       if (!new_bh) {
+               ret = -ENOMEM;
+               mlog_errno(ret);
+               goto out_commit;
+       }
        ocfs2_set_new_buffer_uptodate(&new_tree->rf_ci, new_bh);
 
        ret = ocfs2_journal_access_rb(handle, &new_tree->rf_ci, new_bh,
@@ -1310,7 +1315,7 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle,
 
        new_bh = sb_getblk(sb, blkno);
        if (new_bh == NULL) {
-               ret = -EIO;
+               ret = -ENOMEM;
                mlog_errno(ret);
                goto out;
        }
@@ -1561,7 +1566,7 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle,
 
        new_bh = sb_getblk(sb, blkno);
        if (new_bh == NULL) {
-               ret = -EIO;
+               ret = -ENOMEM;
                mlog_errno(ret);
                goto out;
        }
@@ -3029,7 +3034,7 @@ int ocfs2_duplicate_clusters_by_jbd(handle_t *handle,
        for (i = 0; i < blocks; i++, old_block++, new_block++) {
                new_bh = sb_getblk(osb->sb, new_block);
                if (new_bh == NULL) {
-                       ret = -EIO;
+                       ret = -ENOMEM;
                        mlog_errno(ret);
                        break;
                }