summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/alloc_foreground.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-07-19 20:51:52 +0200
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 23:09:36 +0200
commit90cecb921cfe95858a32995019f11c20b6339607 (patch)
treef9e0a742780d94949d6d6ae6901682b40a272b92 /fs/bcachefs/alloc_foreground.c
parentbcachefs: Use bch2_err_str() in error messages (diff)
downloadlinux-90cecb921cfe95858a32995019f11c20b6339607.tar.xz
linux-90cecb921cfe95858a32995019f11c20b6339607.zip
bcachefs: Prevent a btree iter overflow in alloc path
In bch2_bucket_alloc_trans(), we're iterating over buckets - but not directly with an iterator, since we're iterating over the freespace btree. This means that we need to clear iter->path->preserve, otherwise we'll end up retaining a btree_path for every alloc key we touched - which is not what we want here. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/alloc_foreground.c')
-rw-r--r--fs/bcachefs/alloc_foreground.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index 39e3bb5205ca..a9f893361c73 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -351,6 +351,7 @@ static struct open_bucket *try_alloc_bucket(struct btree_trans *trans, struct bc
if (!ob)
iter.path->preserve = false;
err:
+ set_btree_iter_dontneed(&iter);
bch2_trans_iter_exit(trans, &iter);
printbuf_exit(&buf);
return ob;