Followup-For: Bug #742282

Hi Giorgos,

Does your script trigger this behaviour with btrfs-tools-3.17-1.1?  If
it doesn't, great!  If it does, please read on.

#1: There are known issues with btrfs send|receive when operating on
volumes mounted with the default subvolume (subvolid=5); This is what
happens with a simple mkfs.btrfs /dev/sdX && mount /dev/sdX /mnt/1.
The following instructions exists primarily to gather the negative
results necessary to confirm this.  If it works, you will have
succeeded in providing data that disproves commonly held btrfs lore.
#2 and #3 are also possible causes.

#2: If you still get "no such file or directory," it may be that that
you've encountered one of the "timing issues" in btrfs.  There are
fewer and fewer of these with every release, but I still keep a couple
of "work around the timing issues" lines in my backup scripts.  For
the record, my scripts don't use btrfs send|receive, and I had timing
issues which hung subvolume management until the system was rebooted.
I've also read about some nasty interactions between the loop
subsystem and btrfs...it might be worth increasing the sleep times
even more, in case transactions are stalling somewhere in the loop.
It would be appreciated if you could find a small usb flash drive to
test this, to eliminate the loop subsystem as a contributing factor.

#3: I've read that another data needs to be committed to the disk
before a snapshot actually exists.  This would also explain why you
received a "no such file or directory" error.  Arguably, this is part
of the #2 group of issues, but I've broken it out into it's own point
because #2 is a huge and complicated category of issues.  #3 can be
eliminated simply by making sure that the data is physically on the
disk (eg: sync the FS to get it into a consistent state, then sync to
disk).

Could you please try replacing the btrfs sub section and the btrfs
send section with the following:

btrfs sub create mnt/1/subv
sleep 3
date > mnt/1/subv/fileA
btrfs fi sync /mnt/1
sleep 3
sync
sleep 3
btrfs sub snap -r mnt/1/subv mnt/1/subvROsnap1
date > mnt/1/subv/fileB
btrfs fi sync /mnt/1
sleep 3
sync
sleep 3
btrfs sub snap -r mnt/1/subv mnt/1/subvROsnap2

btrfs send mnt/1/subvROsnap1 | btrfs receive mnt/2
btrfs fi sync /mnt/1
sleep 3
sync
sleep 3
btrfs send -p mnt/1/subvROsnap1 mnt/1/subvROsnap2 | btrfs receive mnt/2
######

and also, if you have the time, please test this one too:

btrfs sub create mnt/1/subv
sleep 3
date > mnt/1/subv/fileA
btrfs sub sync /mnt/1/subv
sleep 3
sync
sleep 3
btrfs sub snap -r mnt/1/subv mnt/1/subvROsnap1
date > mnt/1/subv/fileB
btrfs sub sync /mnt/1
sleep 3
sync
sleep 3
btrfs sub snap -r mnt/1/subv mnt/1/subvROsnap2

btrfs send mnt/1/subvROsnap1 | btrfs receive mnt/2
btrfs sub sync /mnt/1
sleep 3
sync
sleep 3
btrfs send -p mnt/1/subvROsnap1 mnt/1/subvROsnap2 | btrfs receive mnt/2

Kind regards,
Nicholas

Reply via email to