diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index f7b483f0de2a..d4e563281c9e 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c @@ -1346,13 +1346,17 @@ static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb, /* best_size will be allocated, we save prev_best_size */ res->sr_max_contig_bits = prev_best_size; - if (best_size) { - res->sr_bit_offset = best_offset; - res->sr_bits = best_size; - } else { + if (!best_size) { status = -ENOSPC; - /* No error log here -- see the comment above - * ocfs2_test_bg_bit_allocatable */ + } else { + if (best_size) { + res->sr_bit_offset = best_offset; + res->sr_bits = best_size; + } else { + status = -ENOSPC; + /* No error log here -- see the comment above + * ocfs2_test_bg_bit_allocatable */ + } } return status;