diff options
author | Kent Overstreet <kmo@daterainc.com> | 2014-04-11 04:58:49 +0400 |
---|---|---|
committer | Kent Overstreet <kmo@daterainc.com> | 2014-08-05 02:23:02 +0400 |
commit | 9aa61a992acceeec0d1de2cd99938421498659d5 (patch) | |
tree | d414fdba809e0193f0d19d5ea80180ef96f3a23e /drivers/md/bcache/journal.c | |
parent | 5b1016e62f74c53e0330403025954c8d95384c03 (diff) | |
download | linux-9aa61a992acceeec0d1de2cd99938421498659d5.tar.xz |
bcache: Fix a journal replay bug
journal replay wansn't validating pointers with bch_extent_invalid() before
derefing, fixed
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/journal.c')
-rw-r--r-- | drivers/md/bcache/journal.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index 59e82021b5bb..363b88131f01 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -7,6 +7,7 @@ #include "bcache.h" #include "btree.h" #include "debug.h" +#include "extents.h" #include <trace/events/bcache.h> @@ -291,15 +292,16 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list) for (k = i->j.start; k < bset_bkey_last(&i->j); - k = bkey_next(k)) { - unsigned j; + k = bkey_next(k)) + if (!__bch_extent_invalid(c, k)) { + unsigned j; - for (j = 0; j < KEY_PTRS(k); j++) - if (ptr_available(c, k, j)) - atomic_inc(&PTR_BUCKET(c, k, j)->pin); + for (j = 0; j < KEY_PTRS(k); j++) + if (ptr_available(c, k, j)) + atomic_inc(&PTR_BUCKET(c, k, j)->pin); - bch_initial_mark_key(c, 0, k); - } + bch_initial_mark_key(c, 0, k); + } } } |