kdave / btrfs-progs

Development of userspace BTRFS tools
GNU General Public License v2.0
557 stars 242 forks source link

[btrfs-progs v5.4] btrfs receive shows error "no such file or directory" #230

Open sme-gmbh opened 4 years ago

sme-gmbh commented 4 years ago

If a differential transfer is started with

btrfs send -p

and that output is sent to

btrfs receive 

I get an error:

o926824-31440-0: No such file or directory 

This occures rarely and randomly on large volumes.

See details here: https://github.com/masc3d/btrfs-sxbackup/issues/57

In the output of btrfs receive --dump the problematic part looks like this

mkfile          ./.temp.bla123/o926824-31440-0
rename          ./.temp.bla123/o926824-31440-0  dest=./.temp.bla123/bak/router/log/httpd/error.log-20200105
utimes          ./.temp.bla123/bak/router/log/httpd atime=2020-01-08T14:02:47+0100 mtime=2020-01-05T00:00:01+0100 ctime=2020-01-08T14:02:47+0100
write           ./.temp.bla123/o926824-31440-0  offset=0 len=49152
write           ./.temp.bla123/o926824-31440-0  offset=49152 len=49152
write           ./.temp.bla123/o926824-31440-0  offset=98304 len=49152
write           ./.temp.bla123/o926824-31440-0  offset=147456 len=49152
write           ./.temp.bla123/o926824-31440-0  offset=196608 len=49152
write           ./.temp.bla123/o926824-31440-0  offset=245760 len=24002
set_xattr       ./.temp.bla123/o926824-31440-0  name=security.selinux data=system_u:object_r:unlabeled_t:s0 len=33
chown           ./.temp.bla123/o926824-31440-0  gid=1003 uid=1003
chmod           ./.temp.bla123/o926824-31440-0  mode=660
utimes          ./.temp.bla123/o926824-31440-0  atime=2020-01-06T03:05:18+0100 mtime=2020-01-04T23:15:57+0100 ctime=2020-01-06T03:05:18+0100

As you can see a temporary file "o926824-31440-0" is created then renamed and then tried to access with the name it had before renaming. Which cannot work for obvious reason.

The problem started since update to Fedora 31, I'm not quite sure which btrfs-progs version it was before but that worked on that volume.

Initially I got the error while using btrfs-sxbackup, but it looks like it is a problem with btrfs-progs itself, so I'm bringing the issue upstream here.

SudoerReodus commented 4 years ago

I'm experiencing the same issue, and I'm using Fedora 31 too usually the only way to fix the problem is deleting the older snapshots on both source and destination file system and leaving just one (most recent) snapshot and using it as parent. and using it as parent for sends, until btrfs fails again and you have to delete old snapshots again and use the most recent as parent ... it only happens with one of my two file systems. I tried to reformat the drives (and rsync the data back on the source), both source and destination drives, and it doesn't help either ... the same thing happens again after a few snapshots are sent ...

btrfs-progs v5.4 fedora-31-a 5.4.15-200.fc31.x86_64 #1 SMP Tue Jan 28 09:08:32 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

trizt commented 3 years ago

I run into this issue with btrfs-progs v5.10.1 on a ~880GiB data (/home) as the receiving end is a mechanical drive (at least on the same machine), it's a pita to have to make a full send/receive.

Kernel: Linux version 5.11.1-arch-1