From b51435c90307603c0b052134b66e88f0c3d578d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 13 Jan 2014 05:01:56 +0100 Subject: [PATCH] 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. --- udev/udev-qubes-block.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-qubes-block.rules b/udev/udev-qubes-block.rules index 52c4c26..9e989e2 100644 --- a/udev/udev-qubes-block.rules +++ b/udev/udev-qubes-block.rules @@ -10,8 +10,8 @@ ENV{MAJOR}=="202", GOTO="qubes_block_end" ENV{MAJOR}=="253", GOTO="qubes_block_end" IMPORT{db}="QUBES_EXPOSED" -ACTION=="add", IMPORT{program}="/usr/libexec/qubes/udev-block-add-change" -ACTION=="change", IMPORT{program}="/usr/libexec/qubes/udev-block-add-change" +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"