From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: Zoltan <zoltan1980@gmail.com>, Peter Grandi <pg@btrfs.list.sabi.co.uk>
Cc: Linux fs Btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: Is it safe to use btrfs on top of different types of devices?
Date: Thu, 19 Oct 2017 10:27:37 -0400 [thread overview]
Message-ID: <0a93b5df-dad5-ff27-b7d3-ac2519892696@gmail.com> (raw)
In-Reply-To: <CAA-GF5vfbm=fzhRchfTK=w9bHbApUGHeDw7Bgm3awZ1HN6s0jg@mail.gmail.com>
On 2017-10-19 09:48, Zoltan wrote:
> Hi,
>
> On Thu, Oct 19, 2017 at 1:01 PM, Peter Grandi <pg@btrfs.list.sabi.co.uk> wrote:
>
>> What the OP was doing was using "unreliable" both for the case
>> where the device "lies" and the case where the device does not
>> "lie" but reports a failure. Both of these are malfunctions in a
>> wide sense:
>>
>> * The [block] device "lies" as to its status or what it has done.
>> * The [block] device reports truthfully that an action has failed.
>
> Thanks for making this point, it made me realize that I had different
> assumption than what you use in your reasoning. I assumed that when
> writes to a USB device fail due to a temporary disconnection, the
> kernel can actually recognize that a write error happened. So are you
> saying that a write error due to USB problems can go completely
> unnoticed? That seems very strange to me; are USB drives really that
> unreliable or is that some software limitation?
It depends on what type of write error happens.
If it's a case where the data gets corrupted on it's way over the bus,
or the device just drops the write, or you have a bogus storage device
(this is actually a pretty big issue with flash drives and SD cards,
check [1], and [2] for more info on this, and [3] for a tool you can use
to check things), then it generally won't be detected by the kernel, but
might be by the filesystem driver when it tries to read data.
However, it doesn't go completely undetected if the device disconnects
(which is where the big issue with BTRFS comes in), the kernel will
detect the disconnect, issue a bus reset (which will cause performance
issues with other USB devices on the same controller), and generally
recover. However, the disappearance of the device doesn't get
propagated up to the filesystem correctly, and that is what causes the
biggest issue with BTRFS. Because BTRFS just knows writes are suddenly
failing for some reason, it doesn't try to release the device so that
things get properly cleaned up in the kernel, and thus when the same
device reappears (as it will when the disconnect was due to a transient
bus error, which happens a lot), it shows up as a different device node,
which gets scanned for filesystems by udev, and BTRFS then gets really
confused because it now sees 3 (or more) devices for a 2 device
filesystem. That final resultant state is what's so dangerous about
using USB devices with BTRFS right now, as it's pretty much guaranteed
to result in data corruption.
[1] https://fightflashfraud.wordpress.com/
[2] https://sosfakeflash.wordpress.com/
[3] http://oss.digirati.com.br/f3/
next prev parent reply other threads:[~2017-10-19 14:27 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-14 19:00 Is it safe to use btrfs on top of different types of devices? Zoltán Ivánfi
2017-10-15 0:19 ` Peter Grandi
2017-10-15 3:42 ` Duncan
2017-10-15 8:30 ` Zoltán Ivánfi
2017-10-15 12:05 ` Duncan
2017-10-16 11:53 ` Austin S. Hemmelgarn
2017-10-16 16:57 ` Zoltan
2017-10-16 17:27 ` Austin S. Hemmelgarn
2017-10-17 1:14 ` Adam Borowski
2017-10-17 11:26 ` Austin S. Hemmelgarn
2017-10-17 11:42 ` Zoltan
2017-10-17 12:40 ` Austin S. Hemmelgarn
2017-10-17 17:06 ` Adam Borowski
2017-10-17 19:19 ` Austin S. Hemmelgarn
2017-10-17 20:21 ` Adam Borowski
2017-10-17 21:56 ` Zoltán Ivánfi
2017-10-18 4:44 ` Duncan
2017-10-18 14:07 ` Peter Grandi
2017-10-18 11:30 ` Austin S. Hemmelgarn
2017-10-18 11:59 ` Adam Borowski
2017-10-18 14:30 ` Austin S. Hemmelgarn
2017-10-18 4:50 ` Duncan
2017-10-18 13:53 ` Peter Grandi
2017-10-18 14:30 ` Austin S. Hemmelgarn
2017-10-19 11:01 ` Peter Grandi
2017-10-19 12:32 ` Austin S. Hemmelgarn
2017-10-19 18:39 ` Peter Grandi
2017-10-20 11:53 ` Austin S. Hemmelgarn
2017-10-19 13:48 ` Zoltan
2017-10-19 14:27 ` Austin S. Hemmelgarn [this message]
2017-10-19 14:42 ` Zoltan
2017-10-19 15:07 ` Austin S. Hemmelgarn
2017-10-19 18:00 ` Peter Grandi
2017-10-19 17:56 ` Peter Grandi
2017-10-19 18:59 ` Peter Grandi
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=0a93b5df-dad5-ff27-b7d3-ac2519892696@gmail.com \
--to=ahferroin7@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=pg@btrfs.list.sabi.co.uk \
--cc=zoltan1980@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).