Commit a5cd80ea authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix an assertion pop

There was a race: btree node writes drop their reference on journal pins
before clearing the btree_node_write_in_flight flag.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 33ccd718
...@@ -1829,23 +1829,6 @@ void bch2_btree_flush_all_writes(struct bch_fs *c) ...@@ -1829,23 +1829,6 @@ void bch2_btree_flush_all_writes(struct bch_fs *c)
__bch2_btree_flush_all(c, BTREE_NODE_write_in_flight); __bch2_btree_flush_all(c, BTREE_NODE_write_in_flight);
} }
void bch2_btree_verify_flushed(struct bch_fs *c)
{
struct bucket_table *tbl;
struct rhash_head *pos;
struct btree *b;
unsigned i;
rcu_read_lock();
for_each_cached_btree(b, c, tbl, i, pos) {
unsigned long flags = READ_ONCE(b->flags);
BUG_ON((flags & (1 << BTREE_NODE_dirty)) ||
(flags & (1 << BTREE_NODE_write_in_flight)));
}
rcu_read_unlock();
}
void bch2_dirty_btree_nodes_to_text(struct printbuf *out, struct bch_fs *c) void bch2_dirty_btree_nodes_to_text(struct printbuf *out, struct bch_fs *c)
{ {
struct bucket_table *tbl; struct bucket_table *tbl;
......
...@@ -185,7 +185,6 @@ do { \ ...@@ -185,7 +185,6 @@ do { \
void bch2_btree_flush_all_reads(struct bch_fs *); void bch2_btree_flush_all_reads(struct bch_fs *);
void bch2_btree_flush_all_writes(struct bch_fs *); void bch2_btree_flush_all_writes(struct bch_fs *);
void bch2_btree_verify_flushed(struct bch_fs *);
void bch2_dirty_btree_nodes_to_text(struct printbuf *, struct bch_fs *); void bch2_dirty_btree_nodes_to_text(struct printbuf *, struct bch_fs *);
static inline void compat_bformat(unsigned level, enum btree_id btree_id, static inline void compat_bformat(unsigned level, enum btree_id btree_id,
......
...@@ -242,10 +242,7 @@ static void __bch2_fs_read_only(struct bch_fs *c) ...@@ -242,10 +242,7 @@ static void __bch2_fs_read_only(struct bch_fs *c)
* the journal kicks off btree writes via reclaim - wait for in flight * the journal kicks off btree writes via reclaim - wait for in flight
* writes after stopping journal: * writes after stopping journal:
*/ */
if (test_bit(BCH_FS_EMERGENCY_RO, &c->flags))
bch2_btree_flush_all_writes(c); bch2_btree_flush_all_writes(c);
else
bch2_btree_verify_flushed(c);
/* /*
* After stopping journal: * After stopping journal:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment