mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-12-10 00:00:24 +03:00
Fix infinite loop in cmd_list_journal
list_journal can print the entire contents of the journal, and non-dirty entries don't get validated, so we have to account for that. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
fa0a54c45c
commit
241bcd0183
@ -90,9 +90,13 @@ static bool entry_matches_transaction_filter(struct jset_entry *entry,
|
|||||||
if (!entry->level &&
|
if (!entry->level &&
|
||||||
(entry->type == BCH_JSET_ENTRY_btree_keys ||
|
(entry->type == BCH_JSET_ENTRY_btree_keys ||
|
||||||
entry->type == BCH_JSET_ENTRY_overwrite))
|
entry->type == BCH_JSET_ENTRY_overwrite))
|
||||||
jset_entry_for_each_key(entry, k)
|
jset_entry_for_each_key(entry, k) {
|
||||||
|
if (!k->k.u64s)
|
||||||
|
break;
|
||||||
|
|
||||||
if (bkey_matches_filter(filter, entry, k))
|
if (bkey_matches_filter(filter, entry, k))
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,10 +109,13 @@ static bool should_print_transaction(struct jset_entry *entry, struct jset_entry
|
|||||||
bool have_log_messages = false;
|
bool have_log_messages = false;
|
||||||
bool have_non_log_messages = false;
|
bool have_non_log_messages = false;
|
||||||
|
|
||||||
|
if (msg_filter.nr) {
|
||||||
darray_for_each(msg_filter, i)
|
darray_for_each(msg_filter, i)
|
||||||
if (!strncmp(*i, l->d, b))
|
if (!strncmp(*i, l->d, b))
|
||||||
|
goto found;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
found:
|
||||||
if (!key_filter.nr)
|
if (!key_filter.nr)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -140,10 +147,14 @@ static bool should_print_entry(struct jset_entry *entry, d_btree_id filter)
|
|||||||
entry->type != BCH_JSET_ENTRY_overwrite)
|
entry->type != BCH_JSET_ENTRY_overwrite)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
jset_entry_for_each_key(entry, k)
|
jset_entry_for_each_key(entry, k) {
|
||||||
|
if (!k->k.u64s)
|
||||||
|
break;
|
||||||
|
|
||||||
darray_for_each(filter, id)
|
darray_for_each(filter, id)
|
||||||
if (entry->btree_id == *id)
|
if (entry->btree_id == *id)
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -418,6 +418,9 @@ static void journal_entry_btree_keys_to_text(struct printbuf *out, struct bch_fs
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
jset_entry_for_each_key(entry, k) {
|
jset_entry_for_each_key(entry, k) {
|
||||||
|
if (!k->k.u64s)
|
||||||
|
break;
|
||||||
|
|
||||||
if (!first) {
|
if (!first) {
|
||||||
prt_newline(out);
|
prt_newline(out);
|
||||||
bch2_prt_jset_entry_type(out, entry->type);
|
bch2_prt_jset_entry_type(out, entry->type);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user