Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: "Randy Nürnberger" <ranuberger@posteo.de>,
	"Filipe Manana" <fdmanana@kernel.org>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: btrfs send and receive showing errors
Date: Thu, 5 Jan 2023 20:48:03 +0300	[thread overview]
Message-ID: <1539bde6-0b5d-6d15-848b-75493a6ebe06@gmail.com> (raw)
In-Reply-To: <63e8183f-dffb-3ac9-e791-f59e85d2f093@posteo.de>

On 05.01.2023 19:47, Randy Nürnberger wrote:
> On Thu, Jan 5, 2023 at 17:35, Randy Nürnberger wrote:
>> On Thu, Jan 5, 2023 at 17:01, Andrei Borzenkov wrote:
>>> On 05.01.2023 18:55, Randy Nürnberger wrote:
>>>>
>>>> I’ve attached the output of ‘btrfs subvolume list’ for the source and
>>>> the target filesystem.
>>>>
>>>
>>> You have a lot of source subvolumes with the same received_uuid and
>>> you have at least two destination subvolumes with the same
>>> received_uuid. This is wrong, received_uuid is supposed to be unique
>>> identification which explains your errors (incorrect subvolume is
>>> selected).
>>
>> I guess many of my source subvolumes have the same received_uuid,
>> because I created new snapshots from a snapshot that was previously
>> received and the received_uuid just did get copied.
>>
>> I just did a small experiment on another system, created a snapshot
>> from a snapshot that previously was received and could confirm that
>> the received_uuid does indeed get copied. Is this a problem?
> 

No, it is not a problem by itself. Subvolumes used for send/receive are 
supposed to be a remain read-only, so any clone of any subvolume should 
have identical content and you can use any of the clones with the same 
received_uuid. But as soon as you made subvolume read-write, you got 
multiple subvolumes with different content and the same receive_uuid. 
"Doctor, it hurts when I stab myself in the eye".

Never, NEVER, ever, change  subvolume involved in send/receive to 
read-write to use it; clone it (create writable snapshot) and use clone.

> Ha! This seems to be the problem! I’m able to write a small script that
> reproduces the bug! Give me a couple minutes.
> 
> If this is a bug in the kernel,

It is not so much a bug as the consequence of unfortunate design.

> may I write the patch? :D Would be my
> first one :)

The problem is known for years (just search this list) and there are 
patches to clear received_uuid on ro -> rw transition but they are still 
not applied. Personally I would just prohibit such transition completely.

  reply	other threads:[~2023-01-05 17:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04 12:54 btrfs send and receive showing errors Randy Nürnberger
2023-01-04 13:41 ` Filipe Manana
2023-01-05 10:10   ` Randy Nürnberger
2023-01-05 10:42     ` Filipe Manana
2023-01-05 11:33       ` Randy Nürnberger
2023-01-05 11:49         ` Andrei Borzenkov
2023-01-05 15:55           ` Randy Nürnberger
2023-01-05 16:01             ` Andrei Borzenkov
2023-01-05 16:35               ` Randy Nürnberger
2023-01-05 16:47                 ` Randy Nürnberger
2023-01-05 17:48                   ` Andrei Borzenkov [this message]
2023-01-05 18:04                     ` Andrei Borzenkov
2023-01-06 11:13                       ` Randy Nürnberger

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=1539bde6-0b5d-6d15-848b-75493a6ebe06@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=ranuberger@posteo.de \
    /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