From cab059d3b5b9d57677cae5c221e48adfde99b067 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 19 Dec 2016 15:03:05 -0900 Subject: bcache: initialize new journal entries with correct sequence number off by one error :/ --- drivers/md/bcache/journal.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index a6ec23ebfc3f..6848812b37d2 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -1064,12 +1064,12 @@ static void __bch_journal_next_entry(struct journal *j) { struct journal_entry_pin_list pin_list, *p; struct journal_buf *buf; - struct jset *jset; /* * The fifo_push() needs to happen at the same time as j->seq is * incremented for last_seq() to be calculated correctly */ + atomic64_inc(&j->seq); BUG_ON(!fifo_push(&j->pin, pin_list)); p = &fifo_peek_back(&j->pin); @@ -1084,9 +1084,8 @@ static void __bch_journal_next_entry(struct journal *j) buf = journal_cur_buf(j); memset(buf->has_inode, 0, sizeof(buf->has_inode)); - jset = buf->data; - jset->seq = cpu_to_le64(atomic64_inc_return(&j->seq)); - jset->u64s = 0; + buf->data->seq = cpu_to_le64(atomic64_read(&j->seq)); + buf->data->u64s = 0; BUG_ON(journal_pin_seq(j, p) != atomic64_read(&j->seq)); } -- cgit v1.2.3