From db36c1477d1753f4d5bebaed074ca4e4477df3ea Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 23 Jan 2023 20:28:59 -0500 Subject: [PATCH] bcachefs: Fix bch2_bucket_alloc_early() We were incorrectly retrying after a transaction restart. Signed-off-by: Kent Overstreet --- fs/bcachefs/alloc_foreground.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c index 3219c37d9262..471ae15caa75 100644 --- a/fs/bcachefs/alloc_foreground.c +++ b/fs/bcachefs/alloc_foreground.c @@ -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,