diff options
| author | Kent Overstreet <kmo@daterainc.com> | 2014-06-02 18:39:44 -0400 |
|---|---|---|
| committer | Kent Overstreet <kmo@daterainc.com> | 2014-08-04 18:23:03 -0400 |
| commit | 6b708de64adb6dc8319e7aeac922b46904fbeeec (patch) | |
| tree | 84aaf50c2b5b46e669315caf2fd32f143145f2f5 | |
| parent | 913dc33fb2720fb5f979011664294137ddd8b13b (diff) | |
bcache: Fix an infinite loop in journal replay
When running with multiple cache devices, if one of the devices has a completely
empty journal but we'd already found some journal entries on a previosu device
we'd go into an infinite loop.
Change-Id: I1dcdc0d738192746de28f40e8b08825b0dea5e2b
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
| -rw-r--r-- | drivers/md/bcache/journal.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index ead001c9bed8..fe080ad0e558 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c | |||
| @@ -190,9 +190,12 @@ int bch_journal_read(struct cache_set *c, struct list_head *list) | |||
| 190 | if (read_bucket(l)) | 190 | if (read_bucket(l)) |
| 191 | goto bsearch; | 191 | goto bsearch; |
| 192 | 192 | ||
| 193 | if (list_empty(list)) | 193 | /* no journal entries on this device? */ |
| 194 | if (l == ca->sb.njournal_buckets) | ||
| 194 | continue; | 195 | continue; |
| 195 | bsearch: | 196 | bsearch: |
| 197 | BUG_ON(list_empty(list)); | ||
| 198 | |||
| 196 | /* Binary search */ | 199 | /* Binary search */ |
| 197 | m = l; | 200 | m = l; |
| 198 | r = find_next_bit(bitmap, ca->sb.njournal_buckets, l + 1); | 201 | r = find_next_bit(bitmap, ca->sb.njournal_buckets, l + 1); |
