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: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
33ccd7188e
commit
a5cd80ea99
@ -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 { \
|
|||||||
|
|
||||||
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 @@ nowrote_alloc:
|
|||||||
* 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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user