Skip to content

Refreshing BTRFS backed instances is causing a segfault #13085

@roosterfish

Description

@roosterfish

When refreshing Btrfs backed instances the command hangs infinitely and doesn't return. The affected LXD versions are both latest/edge and 5.0/edge.

The error is caused in https://github.com/canonical/lxd/blob/main/lxd/storage/drivers/driver_btrfs_volumes.go#L882 when running the btrfs receive command.

This was first discovered in canonical/lxd-ci#101.

Steps to reproduce

julian@thinkpad:~$ lxc storage create b btrfs
Storage pool b created
julian@thinkpad:~$ lxc launch ubuntu:jammy v1 --vm -s b
Creating v1
Starting v1                               
julian@thinkpad:~$ lxc snapshot v1
julian@thinkpad:~$ lxc cp v1 v2
julian@thinkpad:~$ lxc cp v1 v2 --refresh # doesn't return
root@thinkpad:~# dmesg -w
[34150.527621] btrfs[656287]: segfault at 56 ip 000055a07a36c3b4 sp 00007ffcc2149c60 error 4 in btrfs[55a07a32a000+71000] likely on CPU 12 (core 24, socket 0)
[34150.527663] Code: c0 79 48 e8 2e eb fb ff 4c 89 f6 48 8d 3d dd 31 05 00 44 8b 20 31 c0 41 f7 dc e8 6f 33 fe ff eb 2a 41 83 cd ff 48 85 ed 74 28 <48> 8b 7d 58 e8 63 ea fb ff 48 89 ef e8 5b ea fb ff 41 83 fd ff 74
root@thinkpad:~# journalctl -u snap.lxd.daemon -f
Mär 08 18:40:17 thinkpad lxd.daemon[656287]: ERROR: clone: did not find source subvol

The same is happening for containers. If the source container is stopped it doesn't occur. For VMs it doesn't matter if the VM is running or stopped.

Metadata

Metadata

Labels

BugConfirmed to be a bug

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions