During btree rebuilding, the cursor setup function checks ext_ptr to
report ENOSPC problems when it grabs the first extent for the btree.
However, subsequent grabs for free space don't check ext_ptr and so we
segfault if there's no space. Therefore, move the ENOSPC check into
the loop so that we always complain about insufficient space instead
of just crashing.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
* grab the smallest extent and use it up, then get the
* next smallest. This mimics the init_*_cursor code.
*/
- if ((ext_ptr = findfirst_bcnt_extent(agno)) == NULL)
- do_error(_("error - not enough free space in filesystem\n"));
+ ext_ptr = findfirst_bcnt_extent(agno);
agb_ptr = curs->btree_blocks;
* set up the free block array
*/
while (blocks_allocated < big_extent_len) {
+ if (!ext_ptr)
+ do_error(
+_("error - not enough free space in filesystem\n"));
/*
* use up the extent we've got
*/