bcachefs: Fix bch2_bucket_alloc_early()
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 24 Jan 2023 01:28:59 +0000 (20:28 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:49 +0000 (17:09 -0400)
We were incorrectly retrying after a transaction restart.

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

index 3219c37d92629fc61e92276cf104181de551858c..471ae15caa75dfe59eb95e502bb39d4b7335b631 100644 (file)
@@ -421,12 +421,15 @@ again:
 
        ca->alloc_cursor = alloc_cursor;
 
+       if (!ob && ret)
+               ob = ERR_PTR(ret);
+
        if (!ob && alloc_cursor > alloc_start) {
                alloc_cursor = alloc_start;
                goto again;
        }
 
-       return ob ?: ERR_PTR(ret ?: -BCH_ERR_no_buckets_found);
+       return ob;
 }
 
 static struct open_bucket *bch2_bucket_alloc_freelist(struct btree_trans *trans,