device busy attribute to prevent attaching devices whose children are in use - #144
piotrbartman wants to merge 4 commits into
Conversation
…tries previous udev script just deleted the parent entry when a partition was busy we keep this behavior for local use the "busy marker" is propagated to USB parent
if one of subdevices are locally used (e.g. in sys-usb) the parent is considered busy.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #144 +/- ##
==========================================
+ Coverage 71.24% 71.27% +0.02%
==========================================
Files 6 6
Lines 991 992 +1
==========================================
+ Hits 706 707 +1
Misses 285 285 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
OpenQA test summaryComplete test suite and dependencies: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026071723-devel&flavor=pull-requests Test run included the following:
Upload failures
New failures, excluding unstableCompared to: https://openqa.qubes-os.org/tests/overview?distri=qubesos&version=4.3&build=2026050504-devel&flavor=update
Failed tests22 failures
Fixed failuresCompared to: https://openqa.qubes-os.org/tests/176874#dependencies 25 fixed
Unstable testsDetails
Performance TestsPerformance degradation:19 performance degradations
Remaining performance tests:91 tests
|
A device that is used (mounted etc.) locally by backend VM must not be handed to another one. This exposes them as a `used` ones. The marker means that the device, or it's child in use *locally*. Based on this marker and current attachment we discover if device is `busy`. Only backend VM writes to QubesDB and only about internal state. For this reason `busy` was renamed to `used` in QubesDB path. Mounting generates no block uevent, so qubes-block-mount-watcher polls the mount table and re-triggers the affected devices. `/qubes-device-usage-tracking` tells if a qube reports usage. `udev-qubes-vbd` handles detach `qubes.RefreshBlockDevices` handles attach
for different drivers previous solution does not work and we end up with garbage in qubesDB.
add
busyattribute handling so a device that's in use (attached or used locally) stays visible in QubesDB with a busy=True marker instead of disappearing entirely, and propagates that marker up to the parent disk and the USB ancestor.xs_mark_busy,xs_mark_usb_busyset busy on the device and on the USB parent.usb_parent_still_in_usescans all sibling devices for either attachment or local use, to decide if the USB busy marker can be cleared.qubes.RefreshBlockDevicesre-triggers udev change events for it and its partitions after detach to force a state refresh from the one place that actually knows the truth (backend's sysfs + mount table), instead of guessing from cache.Open items: