btrfs-progs icon indicating copy to clipboard operation
btrfs-progs copied to clipboard

btrfs send: suspend/resume or resize terminal corrupts output (crc32 mismatch)

Open tk-2345 opened this issue 1 month ago • 1 comments

The output of btrfs send gets corrupted, if the system suspends/resumes or the terminal is resized. btrfs send returns 0. The corruption is reported by btrfs receive as “ERROR: crc32 mismatch in command”.

strace shows that the ioctl() used to send the data to user space gets restarted:

ioctl(5, BTRFS_IOC_SEND, {send_fd=7, clone_sources_count=0, clone_sources=NULL, parent_root=0, flags=BTRFS_SEND_FLAG_VERSION}) = ? ERESTARTSYS (To be restarted if SA_RESTART is set)
ioctl(5, BTRFS_IOC_SEND, {send_fd=7, clone_sources_count=0, clone_sources=NULL, parent_root=0, flags=BTRFS_SEND_FLAG_VERSION}) = 0

The output file does not get truncated, probably containing the data of the first ioctl() up to the signal and the second ioctl(). The output file susp is corrupted:

-rw-------. 1 root root 9006882308 Nov 19 10:17 susp
-rw-------. 1 root root 7878804653 Nov 19 10:16 nosusp

See https://discussion.fedoraproject.org/t/btrfs-receive-error-crc32-mismatch-in-command-how-to-proceed/171459.

tk-2345 avatar Nov 20 '25 09:11 tk-2345

This is probably related to https://github.com/kdave/btrfs-progs/issues/719

kdave avatar Nov 20 '25 10:11 kdave