aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2014-03-13 16:44:21 -0400
committerKent Overstreet <kmo@daterainc.com>2014-03-18 15:21:48 -0400
commit27201cfdaa2aeb571191494c1bae6863ffb04108 (patch)
treed5a3bb26a54b5b1e26e8e87c756022ceb2a91c9f
parent65ddf45a3102916fb622c71f7af158b19d49dc7f (diff)
bcache: Fix a journalling reclaim after recovery bug
On recovery we weren't correctly keeping track of what journal buckets had open journal entries, thus it was possible for them to be overwritten until we'd written all new journal entries. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
-rw-r--r--drivers/md/bcache/journal.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 97e6a92da999..4152a9119896 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -237,8 +237,14 @@ bsearch:
237 for (i = 0; i < ca->sb.njournal_buckets; i++) 237 for (i = 0; i < ca->sb.njournal_buckets; i++)
238 if (ja->seq[i] > seq) { 238 if (ja->seq[i] > seq) {
239 seq = ja->seq[i]; 239 seq = ja->seq[i];
240 ja->cur_idx = ja->discard_idx = 240 /*
241 ja->last_idx = i; 241 * When journal_reclaim() goes to allocate for
242 * the first time, it'll use the bucket after
243 * ja->cur_idx
244 */
245 ja->cur_idx = i;
246 ja->last_idx = ja->discard_idx = (i + 1) %
247 ca->sb.njournal_buckets;
242 248
243 } 249 }
244 } 250 }