Commit 5b1016e62f74c53e0330403025954c8d95384c03
1 parent
4c834452aa
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
bcache: Fix a bug when detaching
After detaching a backing device from a cache set, a bit wasn't getting reset meaning the second detach wouldn't work correctly. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff
drivers/md/bcache/super.c
... | ... | @@ -927,6 +927,7 @@ |
927 | 927 | list_move(&dc->list, &uncached_devices); |
928 | 928 | |
929 | 929 | clear_bit(BCACHE_DEV_DETACHING, &dc->disk.flags); |
930 | + clear_bit(BCACHE_DEV_UNLINK_DONE, &dc->disk.flags); | |
930 | 931 | |
931 | 932 | mutex_unlock(&bch_register_lock); |
932 | 933 | |
... | ... | @@ -1405,9 +1406,11 @@ |
1405 | 1406 | if (ca->alloc_thread) |
1406 | 1407 | kthread_stop(ca->alloc_thread); |
1407 | 1408 | |
1408 | - cancel_delayed_work_sync(&c->journal.work); | |
1409 | - /* flush last journal entry if needed */ | |
1410 | - c->journal.work.work.func(&c->journal.work.work); | |
1409 | + if (c->journal.cur) { | |
1410 | + cancel_delayed_work_sync(&c->journal.work); | |
1411 | + /* flush last journal entry if needed */ | |
1412 | + c->journal.work.work.func(&c->journal.work.work); | |
1413 | + } | |
1411 | 1414 | |
1412 | 1415 | closure_return(cl); |
1413 | 1416 | } |