public inbox for linux-bcache@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Robert <damien.olivier.robert@gmail.com>
To: linux-bcache@vger.kernel.org
Subject: clearing inconsistent bcache state
Date: Tue, 2 Dec 2014 23:18:48 +0100	[thread overview]
Message-ID: <20141202221848.GB14759@mithrim> (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!

-- 
Damien Robert
http://www.normalesup.org/~robert/pro

                 reply	other threads:[~2014-12-02 22:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141202221848.GB14759@mithrim \
    --to=damien.olivier.robert@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox