Skip to content

Commit

Permalink
Update bcachefs sources to f3d5e070f2 bcachefs: Convert some assertio…
Browse files Browse the repository at this point in the history
…ns to fsck errors
  • Loading branch information
koverstreet committed Jul 13, 2019
1 parent 08021fd commit e116a3f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .bcachefs_revision
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b5fff1521369ea311f577fe64da9df24be56b91e
f3d5e070f2a0cfa1e8442fbbbcecd40cca132739
30 changes: 25 additions & 5 deletions libbcachefs/buckets.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,8 +846,6 @@ static void bucket_set_stripe(struct bch_fs *c,
struct bucket *g = PTR_BUCKET(ca, ptr, gc);
struct bucket_mark new, old;

BUG_ON(ptr_stale(ca, ptr));

old = bucket_data_cmpxchg(c, ca, fs_usage, g, new, ({
new.dirty = true;
new.stripe = enabled;
Expand All @@ -856,6 +854,26 @@ static void bucket_set_stripe(struct bch_fs *c,
new.journal_seq = journal_seq;
}
}));

/*
* XXX write repair code for these, flag stripe as possibly bad
*/
if (old.gen != ptr->gen)
bch2_fsck_err(c, FSCK_NEED_FSCK,
"stripe with stale pointer");
#if 0
/*
* We'd like to check for these, but these checks don't work
* yet:
*/
if (old.stripe && enabled)
bch2_fsck_err(c, FSCK_NEED_FSCK,
"multiple stripes using same bucket");

if (!old.stripe && !enabled)
bch2_fsck_err(c, FSCK_NEED_FSCK,
"deleting stripe but bucket not marked as stripe bucket");
#endif
}
}

Expand Down Expand Up @@ -884,9 +902,11 @@ static bool bch2_mark_pointer(struct bch_fs *c,
* checked the gen
*/
if (gen_after(new.gen, p.ptr.gen)) {
BUG_ON(!test_bit(BCH_FS_ALLOC_READ_DONE, &c->flags));
EBUG_ON(!p.ptr.cached &&
test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags));
/* XXX write repair code for this */
if (!p.ptr.cached &&
test_bit(JOURNAL_REPLAY_DONE, &c->journal.flags))
bch2_fsck_err(c, FSCK_NEED_FSCK,
"stale dirty pointer");
return true;
}

Expand Down

0 comments on commit e116a3f

Please sign in to comment.