Update bcachefs sources to 4114ced1db bcachefs: Fix allocator shutdown error message

This commit is contained in:
Kent Overstreet 2021-10-01 10:10:55 -04:00
parent beb0846724
commit 37850436dd
3 changed files with 36 additions and 19 deletions

View File

@ -1 +1 @@
0762d9c2948e5574944684a625524545640bf981 4114ced1db465b8f4e7f4d6a78aa11416a9ab5d9

View File

@ -857,10 +857,10 @@ static int bch2_invalidate_buckets(struct bch_fs *c, struct bch_dev *ca)
/* If we used NOWAIT, don't return the error: */ /* If we used NOWAIT, don't return the error: */
if (!fifo_empty(&ca->free_inc)) if (!fifo_empty(&ca->free_inc))
ret = 0; ret = 0;
if (ret) { if (ret < 0)
bch_err(ca, "error invalidating buckets: %i", ret); bch_err(ca, "error invalidating buckets: %i", ret);
if (ret)
return ret; return ret;
}
if (journal_seq) if (journal_seq)
ret = bch2_journal_flush_seq(&c->journal, journal_seq); ret = bch2_journal_flush_seq(&c->journal, journal_seq);

View File

@ -504,22 +504,6 @@ static int bch2_check_fix_ptrs(struct bch_fs *c, enum btree_id btree_id,
struct bucket *g2 = PTR_BUCKET(ca, &p.ptr, false); struct bucket *g2 = PTR_BUCKET(ca, &p.ptr, false);
enum bch_data_type data_type = bch2_bkey_ptr_data_type(*k, &entry->ptr); enum bch_data_type data_type = bch2_bkey_ptr_data_type(*k, &entry->ptr);
if (fsck_err_on(g->mark.data_type &&
g->mark.data_type != data_type, c,
"bucket %u:%zu different types of data in same bucket: %s, %s\n"
"while marking %s",
p.ptr.dev, PTR_BUCKET_NR(ca, &p.ptr),
bch2_data_types[g->mark.data_type],
bch2_data_types[data_type],
(bch2_bkey_val_to_text(&PBUF(buf), c, *k), buf))) {
if (data_type == BCH_DATA_btree) {
g2->_mark.data_type = g->_mark.data_type = data_type;
set_bit(BCH_FS_NEED_ALLOC_WRITE, &c->flags);
} else {
do_update = true;
}
}
if (fsck_err_on(!g->gen_valid, c, if (fsck_err_on(!g->gen_valid, c,
"bucket %u:%zu data type %s ptr gen %u missing in alloc btree\n" "bucket %u:%zu data type %s ptr gen %u missing in alloc btree\n"
"while marking %s", "while marking %s",
@ -536,6 +520,19 @@ static int bch2_check_fix_ptrs(struct bch_fs *c, enum btree_id btree_id,
} }
} }
if (fsck_err_on(data_type == BCH_DATA_btree &&
g->mark.gen != p.ptr.gen, c,
"bucket %u:%zu data type %s has metadata but wrong gen: %u != %u\n"
"while marking %s",
p.ptr.dev, PTR_BUCKET_NR(ca, &p.ptr),
bch2_data_types[ptr_data_type(k->k, &p.ptr)],
p.ptr.gen, g->mark.gen,
(bch2_bkey_val_to_text(&PBUF(buf), c, *k), buf))) {
g2->_mark.data_type = g->_mark.data_type = data_type;
g2->gen_valid = g->gen_valid = true;
set_bit(BCH_FS_NEED_ALLOC_WRITE, &c->flags);
}
if (fsck_err_on(gen_cmp(p.ptr.gen, g->mark.gen) > 0, c, if (fsck_err_on(gen_cmp(p.ptr.gen, g->mark.gen) > 0, c,
"bucket %u:%zu data type %s ptr gen in the future: %u > %u\n" "bucket %u:%zu data type %s ptr gen in the future: %u > %u\n"
"while marking %s", "while marking %s",
@ -566,6 +563,26 @@ static int bch2_check_fix_ptrs(struct bch_fs *c, enum btree_id btree_id,
(bch2_bkey_val_to_text(&PBUF(buf), c, *k), buf))) (bch2_bkey_val_to_text(&PBUF(buf), c, *k), buf)))
do_update = true; do_update = true;
if (p.ptr.gen != g->mark.gen)
continue;
if (fsck_err_on(g->mark.data_type &&
g->mark.data_type != data_type, c,
"bucket %u:%zu different types of data in same bucket: %s, %s\n"
"while marking %s",
p.ptr.dev, PTR_BUCKET_NR(ca, &p.ptr),
bch2_data_types[g->mark.data_type],
bch2_data_types[data_type],
(bch2_bkey_val_to_text(&PBUF(buf), c, *k), buf))) {
if (data_type == BCH_DATA_btree) {
g2->_mark.data_type = g->_mark.data_type = data_type;
g2->gen_valid = g->gen_valid = true;
set_bit(BCH_FS_NEED_ALLOC_WRITE, &c->flags);
} else {
do_update = true;
}
}
if (p.has_ec) { if (p.has_ec) {
struct stripe *m = genradix_ptr(&c->stripes[true], p.ec.idx); struct stripe *m = genradix_ptr(&c->stripes[true], p.ec.idx);