All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randy Nürnberger" <ranuberger@posteo.de>
To: Andrei Borzenkov <arvidjaar@gmail.com>,
	Filipe Manana <fdmanana@kernel.org>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: btrfs send and receive showing errors
Date: Fri,  6 Jan 2023 11:13:21 +0000	[thread overview]
Message-ID: <d2f2cc90-a84a-1054-7be9-1bf4fc77c42c@posteo.de> (raw)
In-Reply-To: <0fd1ae43-6605-cee0-4859-53b9226eb865@gmail.com>

On Thu, Jan 5, 2023 at 19:04, Andrei Borzenkov wrote:
> On 05.01.2023 20:48, Andrei Borzenkov wrote:
>> 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.

I mistakenly thought that creating a new writable snapshot and making a 
read-only snapshot writable were the same operation.

Thinking about it, I understand the difference and why it is there.

>>
>>> 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.
>
> Correction - it was decided to implement in btrfs utils, not in 
> kernel, so "btrfs property" will by default refuse to make read-write 
> subvolume with received_uuid. This is implemented in 5.14.2.

With this knowledge I managed to repare and successfully copy my filesystem.

I have learned a lot. Thank you both for helping me and for your time.

      reply	other threads:[~2023-01-06 11:13 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
2023-01-05 18:04                     ` Andrei Borzenkov
2023-01-06 11:13                       ` Randy Nürnberger [this message]

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=d2f2cc90-a84a-1054-7be9-1bf4fc77c42c@posteo.de \
    --to=ranuberger@posteo.de \
    --cc=arvidjaar@gmail.com \
    --cc=fdmanana@kernel.org \
    --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.