bcache: Journal replay fix
authorKent Overstreet <kmo@daterainc.com>
Fri, 12 Jul 2013 05:42:14 +0000 (22:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 28 Jul 2013 23:30:10 +0000 (16:30 -0700)
commit5e20e8b3713b8a5941891db2626c9eecd3c0888c
tree56018d65da18a1618cf29eddf37a317d260eee00
parent99e56bf5abce5131746397a2ce551fd92ca8f342
bcache: Journal replay fix

commit faa5673617656ee58369a3cfe4a312cfcdc59c81 upstream.

The journal replay code starts by finding something that looks like a
valid journal entry, then it does a binary search over the unchecked
region of the journal for the journal entries with the highest sequence
numbers.

Trouble is, the logic was wrong - journal_read_bucket() returns true if
it found journal entries we need, but if the range of journal entries
we're looking for loops around the end of the journal - in that case
journal_read_bucket() could return true when it hadn't found the highest
sequence number we'd seen yet, and in that case the binary search did
the wrong thing. Whoops.

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/bcache/journal.c