qubes-linux-utils/udev/udev-qubes-block.rules
Marek Marczykowski-Górecki b51435c903 udev: add locking on block device processing
xenstored does handle concurrent writes very harshly - it aborts the
whole transaction if any other write happened the same time. For udev
(which process all the events almost at once) it means hundreds of
retries and in some times even exceed udev timeout (60s or so).
To prevent this problem, add locking to allow only one such event being
processed at once. It looks like it should slow down the system startup,
but actually it does otherwise.
2014-01-13 05:01:56 +01:00

21 lines
787 B
Plaintext

# Expose all (except xen-frontend) block devices via xenstore
# Only block devices are interesting
SUBSYSTEM!="block", GOTO="qubes_block_end"
# Skip xen-blkfront devices
ENV{MAJOR}=="202", GOTO="qubes_block_end"
# Skip device-mapper devices
ENV{MAJOR}=="253", GOTO="qubes_block_end"
IMPORT{db}="QUBES_EXPOSED"
ACTION=="add", IMPORT{program}="/usr/bin/flock /var/run/qubes-udev.lock -c /usr/libexec/qubes/udev-block-add-change"
ACTION=="change", IMPORT{program}="/usr/bin/flock /var/run/qubes-udev.lock -c /usr/libexec/qubes/udev-block-add-change"
ACTION=="remove", RUN+="/usr/libexec/qubes/udev-block-remove"
LABEL="qubes_block_end"
# Cleanup disconnected frontend from xenstore
ACTION=="remove", SUBSYSTEM=="block", ENV{MAJOR}=="202", RUN+="/usr/libexec/qubes/udev-block-cleanup"