bcachefs: fix ja->cur_idx use while reading journal
authorKent Overstreet <kent.overstreet@gmail.com>
Tue, 18 Dec 2018 15:15:35 +0000 (10:15 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:14 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/journal_io.c

index 4178dd9ceb8e91ee3e0a4a81efb5a85160a79c62..67ff2633ba16a3e3301c78b398baa82720bc0c3c 100644 (file)
@@ -584,7 +584,7 @@ static void bch2_journal_read_device(struct closure *cl)
        while (ja->bucket_seq[ja->cur_idx] > min_seq &&
               ja->bucket_seq[ja->cur_idx] >
               ja->bucket_seq[(ja->cur_idx + 1) % ja->nr])
-               ja->cur_idx++;
+               ja->cur_idx = (ja->cur_idx + 1) % ja->nr;
 
        ja->sectors_free = 0;