mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-08 02:38:14 +00:00
bcachefs: Fix usage of last_seq + encryption
jset->last_seq is in the region that's encrypted - on journal write completion, we were using it and getting garbage. This patch shadows it to fix. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
ac1019d32b
commit
1784d43a88
@ -189,7 +189,8 @@ static bool __journal_entry_close(struct journal *j)
|
|||||||
* Hence, we want update/set last_seq on the current journal entry right
|
* Hence, we want update/set last_seq on the current journal entry right
|
||||||
* before we open a new one:
|
* before we open a new one:
|
||||||
*/
|
*/
|
||||||
buf->data->last_seq = cpu_to_le64(journal_last_seq(j));
|
buf->last_seq = journal_last_seq(j);
|
||||||
|
buf->data->last_seq = cpu_to_le64(buf->last_seq);
|
||||||
|
|
||||||
__bch2_journal_pin_put(j, le64_to_cpu(buf->data->seq));
|
__bch2_journal_pin_put(j, le64_to_cpu(buf->data->seq));
|
||||||
|
|
||||||
|
|||||||
@ -1236,7 +1236,7 @@ static void journal_write_done(struct closure *cl)
|
|||||||
bch2_bkey_devs(bkey_i_to_s_c(&w->key));
|
bch2_bkey_devs(bkey_i_to_s_c(&w->key));
|
||||||
struct bch_replicas_padded replicas;
|
struct bch_replicas_padded replicas;
|
||||||
union journal_res_state old, new;
|
union journal_res_state old, new;
|
||||||
u64 v, seq, last_seq;
|
u64 v, seq;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
bch2_time_stats_update(j->write_time, j->write_start_time);
|
bch2_time_stats_update(j->write_time, j->write_start_time);
|
||||||
@ -1255,7 +1255,6 @@ static void journal_write_done(struct closure *cl)
|
|||||||
|
|
||||||
spin_lock(&j->lock);
|
spin_lock(&j->lock);
|
||||||
seq = le64_to_cpu(w->data->seq);
|
seq = le64_to_cpu(w->data->seq);
|
||||||
last_seq = le64_to_cpu(w->data->last_seq);
|
|
||||||
|
|
||||||
if (seq >= j->pin.front)
|
if (seq >= j->pin.front)
|
||||||
journal_seq_pin(j, seq)->devs = devs;
|
journal_seq_pin(j, seq)->devs = devs;
|
||||||
@ -1266,7 +1265,7 @@ static void journal_write_done(struct closure *cl)
|
|||||||
|
|
||||||
if (!JSET_NO_FLUSH(w->data)) {
|
if (!JSET_NO_FLUSH(w->data)) {
|
||||||
j->flushed_seq_ondisk = seq;
|
j->flushed_seq_ondisk = seq;
|
||||||
j->last_seq_ondisk = last_seq;
|
j->last_seq_ondisk = w->last_seq;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1400,7 +1399,7 @@ void bch2_journal_write(struct closure *cl)
|
|||||||
test_bit(JOURNAL_MAY_SKIP_FLUSH, &j->flags)) {
|
test_bit(JOURNAL_MAY_SKIP_FLUSH, &j->flags)) {
|
||||||
w->noflush = true;
|
w->noflush = true;
|
||||||
SET_JSET_NO_FLUSH(jset, true);
|
SET_JSET_NO_FLUSH(jset, true);
|
||||||
jset->last_seq = 0;
|
jset->last_seq = w->last_seq = 0;
|
||||||
|
|
||||||
j->nr_noflush_writes++;
|
j->nr_noflush_writes++;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -23,6 +23,7 @@ struct journal_buf {
|
|||||||
__BKEY_PADDED(key, BCH_REPLICAS_MAX);
|
__BKEY_PADDED(key, BCH_REPLICAS_MAX);
|
||||||
|
|
||||||
struct closure_waitlist wait;
|
struct closure_waitlist wait;
|
||||||
|
u64 last_seq; /* copy of data->last_seq */
|
||||||
|
|
||||||
unsigned buf_size; /* size in bytes of @data */
|
unsigned buf_size; /* size in bytes of @data */
|
||||||
unsigned sectors; /* maximum size for current entry */
|
unsigned sectors; /* maximum size for current entry */
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user