summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-12-19 15:03:05 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:41:30 -0900
commitcab059d3b5b9d57677cae5c221e48adfde99b067 (patch)
tree16d1a6723cdfafdfdbae94a25dc5120c37f575dc
parent2cbcc7c3a1230d5e249dfbf1664bccacd1a65ec6 (diff)
bcache: initialize new journal entries with correct sequence number
off by one error :/
-rw-r--r--drivers/md/bcache/journal.c7
1 files 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));
}