On Mon, Jan 21, 2019 at 3:23 PM Chris Murphy <lists@xxxxxxxxxxxxxxxxx> wrote:
> If <parent> has a UUID of 54321, I expect that <subvol> must have
> Parent UUID of 54321, or the send command should fail.
OK I think the following is a reproducible bug.
# btrfs sub create 1
# btrfs sub create 2
# touch 1/one
# touch 2/two
# btrfs sub snap -r 1 1.ro1
# btrfs sub snap -r 2 2.ro1
# touch 1/oneone
# touch 2/twotwo
# btrfs sub snap -r 1 1.ro2
# btrfs sub snap -r 2 2.ro2
# btrfs send 1.ro1 | ssh chris@fnuc.local "sudo btrfs receive /srv/scratch/"
At subvol 1.ro1
At subvol 1.ro1
# btrfs send 2.ro1 | ssh chris@fnuc.local "sudo btrfs receive /srv/scratch/"
At subvol 2.ro1
At subvol 2.ro1
# btrfs send -p 1.ro1 2.ro2 | ssh chris@fnuc.local "sudo btrfs receive
/srv/scratch/"
At subvol 2.ro2
At snapshot 2.ro2
#
I expect the last command to fail because 1.ro1 is not the parent of
2.ro2. The command completes, and 2.ro2 is on the destination, and at
least in this simple example it contains the expected files. However
'btrfs show' indicates that the "parent UUID" of 2.ro2 is the "UUID"
of 1.ro1, which is definitely wrong. So it's a legit bug, not just a
cosmetic problem due to lack of error checking.
$ ls -l 1.ro1
total 0
-rw-rw-r--. 1 chris chris 0 Jan 21 21:41 one
$ ls -l 2.ro1
total 0
-rw-rw-r--. 1 chris chris 0 Jan 21 21:41 two
$ ls -l 2.ro2
total 0
-rw-rw-r--. 1 chris chris 0 Jan 21 21:41 two
-rw-rw-r--. 1 chris chris 0 Jan 21 21:41 twotwo
$
fnuc.local chris / srv scratch sudo btrfs sub show 1.ro1
scratch/1.ro1
Name: 1.ro1
UUID: eb0bb290-3f7d-d34d-94c3-1ed9da96f2fa
Parent UUID: -
Received UUID: b965a4b6-e77d-714b-af0e-83e15e734fd5
Creation time: 2019-01-21 21:43:04 -0700
Subvolume ID: 3107
Generation: 25788
Gen at creation: 25782
Parent ID: 2039
Top level ID: 2039
Flags: readonly
Snapshot(s):
scratch/2.ro2
fnuc.local chris / srv scratch sudo btrfs sub show 1.ro2
ERROR: cannot find real path for '1.ro2': No such file or directory
fnuc.local chris / srv scratch sudo btrfs sub show 2.ro1
scratch/2.ro1
Name: 2.ro1
UUID: ce0d762a-d4ea-6448-aa71-1573d70fe60e
Parent UUID: -
Received UUID: d382f4f9-23c9-394e-852d-ecbe9a95fa75
Creation time: 2019-01-21 21:43:15 -0700
Subvolume ID: 3108
Generation: 25786
Gen at creation: 25785
Parent ID: 2039
Top level ID: 2039
Flags: readonly
Snapshot(s):
fnuc.local chris / srv scratch sudo btrfs sub show 2.ro2
scratch/2.ro2
Name: 2.ro2
UUID: 165a4a66-0600-3b49-80aa-edae8fd850d9
Parent UUID: eb0bb290-3f7d-d34d-94c3-1ed9da96f2fa
Received UUID: b8343d21-882f-bf47-ac61-b59e53b126a4
Creation time: 2019-01-21 21:43:38 -0700
Subvolume ID: 3109
Generation: 25789
Gen at creation: 25788
Parent ID: 2039
Top level ID: 2039
Flags: readonly
Snapshot(s):
fnuc.local chris / srv scratch
--
Chris Murphy