linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* btrfs send picks wrong subvolume UUID
@ 2022-01-02  4:17 Dāvis Mosāns
  2022-01-02 20:37 ` Andrei Borzenkov
  0 siblings, 1 reply; 7+ messages in thread
From: Dāvis Mosāns @ 2022-01-02  4:17 UTC (permalink / raw)
  To: Btrfs

Hi,

I have a bunch of snapshots I want to send from one fs to another,
but it seems btrfs send is using received UUID instead of subvolumes own UUID
causing wrong subvolume to be picked by btrfs receive and thus failing.

$ btrfs subvolume show /mnt/fs/2019-11-02/etc | head -n 5
2019-11-02/etc
        Name:                   etc
        UUID:                   389ebc5e-341a-fb4a-b838-a2b7976b8220
        Parent UUID:            36d5d44b-9eaf-8542-8243-ad0dc45b8abd
        Received UUID:          15bd7d35-9f98-0b48-854c-422c445f7403

$ btrfs send /mnt/fs/2019-11-02/etc | btrfs receive --dump | head -n 2
At subvol /mnt/fs/2019-11-02/etc
subvol          ./etc
uuid=15bd7d35-9f98-0b48-854c-422c445f7403 transid=1727996
chown           ./etc/                          gid=0 uid=0
$ btrfs send /mnt/fs/2019-11-02/etc | btrfs receive /mnt/newFS/2019-11-02/
At subvol /mnt/fs/2019-11-02/etc
At subvol etc

$ btrfs subvolume show /mnt/fs/2020-09-21/etc | head -n 5
2020-09-21/etc
        Name:                   etc
        UUID:                   1c6a0138-b23b-244f-82d8-e2fcaa20870f
        Parent UUID:            36d5d44b-9eaf-8542-8243-ad0dc45b8abd
        Received UUID:          15bd7d35-9f98-0b48-854c-422c445f7403

$ btrfs send -c /mnt/fs/2019-11-02/etc -p /mnt/fs/2019-11-02/etc
/mnt/fs/2020-09-21/etc | btrfs receive --dump | head -n 2
At subvol /mnt/fs/2020-09-21/etc
snapshot        ./etc
uuid=15bd7d35-9f98-0b48-854c-422c445f7403 transid=2148016
parent_uuid=15bd7d35-9f98-0b48-854c-422c445f7403
parent_transid=1727996
utimes          ./etc/
atime=2019-08-11T14:56:46+0300 mtime=2020-09-21T20:30:38+0300
ctime=2020-09-21T20:30:38+0300
$ btrfs send -c /mnt/fs/2019-11-02/etc -p /mnt/fs/2019-11-02/etc
/mnt/fs/2020-09-21/etc | btrfs receive /mnt/newFS/2020-09-21/
At subvol /mnt/fs/2020-09-21/etc
At snapshot etc

$ btrfs subvolume list -opuqR /mnt/newFS/
ID 373 gen 1965 parent 276 top level 276 parent_uuid -
                   received_uuid 15bd7d35-9f98-0b48-854c-422c445f7403
uuid 4a21e16f-ab4e-1f45-900a-541ead4e9fa4 path 2019-11-02/etc
ID 374 gen 1968 parent 276 top level 276 parent_uuid
4a21e16f-ab4e-1f45-900a-541ead4e9fa4 received_uuid
15bd7d35-9f98-0b48-854c-422c445f7403 uuid
7e19706d-4cf4-8245-ae02-1bdd99f92e48 path 2020-09-21/etc

As you can see received_uuid is same for both and it's not the UUID of
source subvolume


$ btrfs subvolume show /mnt/fs/2020-12-09/etc | head -n 5
2020-12-09/etc
        Name:                   etc
        UUID:                   2902708e-2ebf-654a-8b03-f854e031f8c7
        Parent UUID:            36d5d44b-9eaf-8542-8243-ad0dc45b8abd
        Received UUID:          15bd7d35-9f98-0b48-854c-422c445f7403

$ btrfs send -c /mnt/fs/2020-09-21/etc -p /mnt/fs/2020-09-21/etc
/mnt/fs/2020-12-09/etc | btrfs receive --dump | head -n 2
At subvol /mnt/fs/2020-12-09/etc
snapshot        ./etc
uuid=15bd7d35-9f98-0b48-854c-422c445f7403 transid=2212940
parent_uuid=15bd7d35-9f98-0b48-854c-422c445f7403
parent_transid=2148016
utimes          ./etc/
atime=2019-08-11T14:56:46+0300 mtime=2020-12-08T17:50:18+0200
ctime=2020-12-08T17:50:18+0200
$ btrfs send -c /mnt/fs/2020-09-21/etc -p /mnt/fs/2020-09-21/etc
/mnt/fs/2020-12-09/etc | btrfs receive /mnt/newFS/2020-12-09/
At subvol /mnt/fs/2020-12-09/etc
At snapshot etc
ERROR: unlink o86334-1390558-0/d42ee4920c54898f1957cd2f38799f735dfa05
failed: No such file or directory

Here it fails because it actually used target's 2019-11-02/etc
subvolume as parent instead of 2020-09-21/etc like we specified.
We can see that in strace:
$ btrfs send -c /mnt/fs/2020-09-21/etc -p /mnt/fs/2020-09-21/etc
/mnt/fs/2020-12-09/etc | strace btrfs receive /mnt/newFS/2020-12-09/
2>&1 | grep -E '2019-11-02|SNAP_CREATE'
At subvol /mnt/fs/2020-12-09/etc
ioctl(4, BTRFS_IOC_INO_LOOKUP, {treeid=276, objectid=261} =>
{name="2019-11-02/"}) = 0
openat(4, "2019-11-02/etc", O_RDONLY|O_NOATIME) = 5
ioctl(3, BTRFS_IOC_SNAP_CREATE_V2, {fd=5, flags=0, name="etc"} =>
{transid=0}) = 0

Best regards,
Dāvis

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-12 11:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-02  4:17 btrfs send picks wrong subvolume UUID Dāvis Mosāns
2022-01-02 20:37 ` Andrei Borzenkov
2022-01-03 18:09   ` Dāvis Mosāns
2022-01-11 15:33     ` Nikolay Borisov
2022-01-11 16:46       ` Dāvis Mosāns
2022-01-12 11:29         ` David Sterba
2022-01-12 11:37     ` David Sterba

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).