]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bcachefs: add missing locking in bch2_write_point_to_text()
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 12 May 2025 18:54:07 +0000 (14:54 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Thu, 22 May 2025 00:14:56 +0000 (20:14 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/alloc_foreground.c

index 828cf94217ddc73c204651d08f80c610560d3872..6aefa490ec242ace4c8cc467407b238148e6a9d1 100644 (file)
@@ -1517,6 +1517,8 @@ static void bch2_write_point_to_text(struct printbuf *out, struct bch_fs *c,
        struct open_bucket *ob;
        unsigned i;
 
+       mutex_lock(&wp->lock);
+
        prt_printf(out, "%lu: ", wp->write_point);
        prt_human_readable_u64(out, wp->sectors_allocated << 9);
 
@@ -1534,6 +1536,8 @@ static void bch2_write_point_to_text(struct printbuf *out, struct bch_fs *c,
        open_bucket_for_each(c, &wp->ptrs, ob, i)
                bch2_open_bucket_to_text(out, c, ob);
        printbuf_indent_sub(out, 2);
+
+       mutex_unlock(&wp->lock);
 }
 
 void bch2_write_points_to_text(struct printbuf *out, struct bch_fs *c)