Skip to contentSkip to conversation

clearing inconsistent bcache state

DISCUSSION Damien Robert 1 participant 1 message Dec 2, 2014 bcache (block layer cache)

lore
Share & tools
lore
#0 lore raw

I had enabled bcache on writeback, but once when booting my laptop I got the following error message
error on ...: corrupted btree at bucket ... disabling caching

Since I was on a plane I just forced bcache to continue by doing
echo 1 > bcache/running

Amazingly the backing device recovered without problem
(the power of btrfs, I even checked with btrfs scrub); probably there was not a lot of dirty data.

So I'd like to enable bcache caching again (even if there was an error previously, all my data is backuped to several other computers so I can afford to lose it).

I recreated my caching device again with make-bcache -B (after cleaning up the signature so it would accept to run), and attached the device to the backing device again.

The problem is that it detect that the backing device was uncleanly cut away from its caching device, and 'state' is inconsistent:

Mithrim /sys/block/bcache0/bcache $ sudo bcache-super-show /dev/sda3

sb.magic                ok
sb.first_sector         8 [match]
sb.csum                 9694497C61198C4 [match]
sb.version              1 [backing device]
dev.label               (empty)
dev.uuid                56e8d6b3-9a68-4df3-8f4a-dfbf535a9575
dev.sectors_per_block   1
dev.sectors_per_bucket  1024
dev.data.first_sector   16
dev.data.cache_mode     1 [writeback]
dev.data.cache_state    3 [inconsistent]

cset.uuid b67e71bc-8b3d-43c5-9048-c3b182cc77ec

Of course this disable all effective caching, as seen in the stats or in the caching device bcache/written which are all 0.

So I have two questions:
1) was there a better way to recover from the corrupted btree than forcing the backing device to run without the cache?
2) Is there a way to tell bcache to put the backing device back in a consistent state so that caching get enabled again?
[I would like not to format it again via a make-bcache -B, my data is backuped but reinstalling the laptop and transfering the data back is annoying]

Thanks!

Signature · 2 lines
Damien Robert
http://www.normalesup.org/~robert/pro