From: "Austin S. Hemmelgarn" <ahferroin7@gmail.com>
To: Wang Yugui <wangyugui@e16-tech.com>,
Btrfs BTRFS <linux-btrfs@vger.kernel.org>
Cc: Forza <forza@tnonline.net>, Qu Wenruo <wqu@suse.com>,
Qu Wenruo <quwenruo.btrfs@gmx.com>
Subject: Re: What mechanisms protect against split brain?
Date: Wed, 8 Jun 2022 07:40:46 -0400 [thread overview]
Message-ID: <99585fd0-ba79-f03a-582d-db1c1b0e4e78@gmail.com> (raw)
In-Reply-To: <a97ff3a3-7b14-e6a4-32e9-b9da8cec422e@gmx.com>
On 08/06/2022 06.32, Qu Wenruo wrote:
> In fact, fully split brain (both have the same generation, but
> experienced their own degraded mount) case can not be solved by btrfs
> itself at all.
>
> Btrfs can only solve partial split brain case (one device has higher
> generation, thus btrfs can still determine which copy is the correct one).
Of note, this is not unique to BTRFS. The quorum requirement that Ceph
and many other distributed storage systems impose on writes exists to
very specifically avoid this type of situation.
>
>>
>> #!/bin/bash
>> set -uxe -o pipefail
>>
>> mnt=/mnt/test
>> dev1=/dev/vdb1
>> dev2=/dev/vdb2
>>
>> dmesg -C
>> mkdir -p $mnt
>>
>> mkfs.btrfs -f -m raid1 -d raid1 $dev1 $dev2
>> mount $dev1 $mnt
>> xfs_io -f -c "pwrite -S 0xee 0 1M" $mnt/file1
>> sync
>> umount $mnt
>>
>> btrfs dev scan -u $dev2
>> mount -o degraded $dev1 $mnt
>> #xfs_io -f -c "pwrite -S 0xff 0 128M" $mnt/file2
>> mkdir -p $mnt/branch1; /bin/cp -R /usr/bin $mnt/branch1 #complex
>> than xfs_io
>> umount $mnt
>>
>> btrfs dev scan
>> btrfs dev scan -u $dev1
>> mount -o degraded $dev2 $mnt
>
> Your case is the full split brain case.
>
> Not possible to solve.
>
> In fact, if you don't do the degraded mount on dev2, btrfs is completely
> fine to resilve the fs without any problem.
>
And this, in turn, is why BTRFS refuses to mount degraded without the
user explicitly asking for it, and why having `degraded` in your mount
options in `/etc/fstab` (or on the kernel command line) is so dangerous.
There’s no way for BTRFS (or the block layer for that matter) to
reliably differentiate between a missing device resulting from a device
failure and a missing device resulting from other issues, and those
other issues can easily result in one half of a two-device volume not
being present for one boot, and the other half not being present on the
next boot.
next prev parent reply other threads:[~2022-06-08 11:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-29 11:34 What mechanisms protect against split brain? Forza
2022-06-08 2:44 ` Wang Yugui
2022-06-08 10:15 ` Wang Yugui
2022-06-08 10:32 ` Qu Wenruo
2022-06-08 10:58 ` Wang Yugui
2022-06-08 11:19 ` Qu Wenruo
2022-06-08 11:55 ` Wang Yugui
2022-06-08 11:59 ` Qu Wenruo
2022-06-08 11:40 ` Austin S. Hemmelgarn [this message]
2022-06-08 14:11 ` Andrei Borzenkov
2022-06-08 20:22 ` Forza
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=99585fd0-ba79-f03a-582d-db1c1b0e4e78@gmail.com \
--to=ahferroin7@gmail.com \
--cc=forza@tnonline.net \
--cc=linux-btrfs@vger.kernel.org \
--cc=quwenruo.btrfs@gmx.com \
--cc=wangyugui@e16-tech.com \
--cc=wqu@suse.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