summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-03-21 14:08:01 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:37 -0400
commitfa4dc3987b8e75ec1bfd327bb05755d153c276d6 (patch)
tree58c1bbc3ee616027edd935dd3849a586b0125ba3 /fs
parent8666a9ad6facc153d143728c8b47aae1e8111cd6 (diff)
bcachefs: Fix count_iters_for_insert()
This fixes a transaction iterator overflow. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/extent_update.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/extent_update.c b/fs/bcachefs/extent_update.c
index beb3b694e33c..8e5070d5a39b 100644
--- a/fs/bcachefs/extent_update.c
+++ b/fs/bcachefs/extent_update.c
@@ -44,6 +44,10 @@ static int count_iters_for_insert(struct btree_trans *trans,
* extent we're inserting and overwriting:
*/
*nr_iters += 1;
+ if (*nr_iters >= max_iters) {
+ *end = bpos_min(*end, k.k->p);
+ ret = 1;
+ }
switch (k.k->type) {
case KEY_TYPE_extent: