repeat:
                /* allocate space in core */
                *errp = ext4_mb_regular_allocator(ac);
-               if (*errp) {
-                       ext4_discard_allocated_blocks(ac);
-                       goto errout;
-               }
+               if (*errp)
+                       goto discard_and_exit;
 
                /* as we've just preallocated more space than
-                * user requested orinally, we store allocated
+                * user requested originally, we store allocated
                 * space in a special descriptor */
                if (ac->ac_status == AC_STATUS_FOUND &&
-                               ac->ac_o_ex.fe_len < ac->ac_b_ex.fe_len)
-                       ext4_mb_new_preallocation(ac);
+                   ac->ac_o_ex.fe_len < ac->ac_b_ex.fe_len)
+                       *errp = ext4_mb_new_preallocation(ac);
+               if (*errp) {
+               discard_and_exit:
+                       ext4_discard_allocated_blocks(ac);
+                       goto errout;
+               }
        }
        if (likely(ac->ac_status == AC_STATUS_FOUND)) {
                *errp = ext4_mb_mark_diskspace_used(ac, handle, reserv_clstrs);