bcachefs: Fix bch2_alloc_sectors_start_trans() error handling
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 19 Dec 2023 22:16:34 +0000 (17:16 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Wed, 20 Dec 2023 00:01:52 +0000 (19:01 -0500)
commit247ce5f1bb3ea90879e8552b8edf4885b9a9f849
tree87ec37ba68fb1565d8da1ad84e4c2b6085ce093d
parent7ba1f6ec97c7afec5787ab8e92a6a7e24f0459aa
bcachefs: Fix bch2_alloc_sectors_start_trans() error handling

When we fail to allocate because of insufficient open buckets, we don't
want to retry from the full set of devices - we just want to retry in
blocking mode.

But if the retry in blocking mode fails with a different error code, we
end up squashing the -BCH_ERR_open_buckets_empty error with an error
that makes us thing we won't be able to allocate (insufficient_devices)
- which is incorrect when we didn't try to allocate from the full set of
devices, and causes the write to fail.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_foreground.c