Creating concurrent snapshots / trackers of multiple block devices terminates the first one uncleanly
bug
### Distribution
Debian 12
### Architecture
amd64
### Kernel version
Linux 6.1.0-32-amd #1 SMP PREEMPT_DYNAMIC Debian 6.1.129-1 (2025-03-06) x86_64 GNU/Linux
### Blksnap version
VAL-6.1 branch (6.1.2.1781) and also VAL-6.3 branch (6.3.0.73)
### Bug description
When creating concurrent snapshots/trackers of different block devices, creating the second one, causes the first one to be cleaned up in a kind of unclean way.
### Steps to reproduce
1. Ordinary GPT disk with EXT4 partitions- `sda (sda1, sda2, sda3)`
2. Create tracker1 + snapshot1 for first block device
- `ID=$(blksnap snapshot_create --device /dev/sda1 | grep ...)`
- `blksnap stretch_snapshot --id $ID --path /.some-temp-path-snapshot1 --limit 1024 &`
- `blksnap snapshot_take --id $ID`
- `blksnap snapshot_collect --id $ID` # find maj:min device for the snapshot
3. Create tracker2 + snapshot2 for second block device
- Same 4 commands but for e.g. /dev/sda2
5. Free snapshot2 + tracker2 for second block device
- `blksnap snapshot_destroy $ID`
- kill the stretch_snapshot $PID...
- wait for the stretch_snapshot $PID...
- `blksnap tracker_remove --device /dev/sda2`
- `rm /.some-temp-path-snapshot2* || true`
7. Free snapshot1 + tracker1 for first block device
- Same steps
### Expected behavior
The snapshot/tracker for both devices should be safely removed.
But what happens instead is: After creating the 2nd device's snapshot/tracker,
- the first snapshot disappears
- the first stretch_snapshot PID exits
- the snapshot_collect output includes only the snapshot from the 2nd device, not the first
- The first tracker cannot be removed. It is stuck in some `device busy` error.
- The first block device snapshotted cannot be snapshotted again.
There are these errors in dmesg:
```
Failed to copy data to diff storage with error 4
Unable to destory snapshot: cannot find snapshot by id ...
Removing device [8:1] from tracking
Tracker for device [8:1] is busy with a snapshot
```
### Additional information
I'm happy to provide any other wanted information,
6 条评论