From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: btrfs check segfaults after flipping 2 Bytes
Date: Wed, 1 Oct 2014 23:31:59 +0000 (UTC) [thread overview]
Message-ID: <pan$36400$3ee14aa9$ee1e5a94$415ce7b2@cox.net> (raw)
In-Reply-To: 542C6443.1010809@niklasfi.de
Niklas Fischer posted on Wed, 01 Oct 2014 22:29:55 +0200 as excerpted:
> I was trying to determine how btrfs reacts to disk errors, when I
> discovered, that flipping two Bytes, supposedly inside of a file can
> render the filesystem unusable. Here is what I did:
>
> 1. dd if=/dev/zero of=/dev/sdg2 bs=1M
> 2. mkfs.btrfs /dev/sdg2
> 3. mount /dev/sdg2 /tmp/btrfs
> 4. echo "hello world this is some text" > /tmp/btrfs/hello
> 5. umount /dev/sdg2
Keep in mind that on btrfs, small enough files will not be written to
file extents but instead will be written directly into the metadata.
That's a small enough file I guess that's what you were seeing, which
would explain the two instances of the string, since on a single device
btrfs, metadata is dup mode by default.
That metadata block would then fail checksum, and an attempt would be
made to use the second copy, which of course would fail it the same way.
And that being the only file in the filesystem, I'd /guess/ (not being a
developer myself, just a btrfs testing admin and list regular) that
metadata block is still the original one, which very likely contains
critical filesystem information as well, thus explaining the mount
failure when the block failed checksum verify.
In theory at least, with a less synthetic test case there'd be enough
more metadata on the filesystem that the affected metadata block would be
further down the chain, and corrupting it wouldn't corrupt critical
filesystem information as it wouldn't be in the same block.
That might explain the problem, but I don't know enough about btrfs to
know how reasonable a solution would be. I guess a btrfs dev should know.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
next prev parent reply other threads:[~2014-10-01 23:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 20:29 btrfs check segfaults after flipping 2 Bytes Niklas Fischer
2014-10-01 20:34 ` Niklas Fischer
2014-10-01 23:31 ` Duncan [this message]
2014-10-02 5:51 ` Brendan Hide
2014-10-02 10:58 ` Duncan
2014-10-02 18:38 ` Brendan Hide
2014-10-06 2:29 ` Qu Wenruo
2014-10-06 4:10 ` Duncan
2014-10-06 4:13 ` Qu Wenruo
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='pan$36400$3ee14aa9$ee1e5a94$415ce7b2@cox.net' \
--to=1i5t5.duncan@cox.net \
--cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.