udev: better support device-mapper/LVM

Do not ignore them completely.
This commit is contained in:
Marek Marczykowski-Górecki 2014-06-07 04:53:32 +02:00
parent affc4fd3a9
commit 570446f448
2 changed files with 10 additions and 1 deletions

9
udev/udev-block-add-change Executable file → Normal file
View File

@ -23,6 +23,11 @@ if [ -n "`ls -A /sys/$DEVPATH/holders 2> /dev/null`" ]; then
xs_remove
exit 0
fi
# ... and used device-mapper devices
if [ -n "$DM_NAME" ] && /usr/sbin/dmsetup info "$DM_NAME" | grep -q "^Open count:.*[1-9]"; then
xs_remove
exit 0
fi
# ... and "empty" loop devices
if [ "$MAJOR" -eq 7 -a ! -d /sys/$DEVPATH/loop ]; then
xs_remove
@ -48,6 +53,10 @@ fi
if [ -d /sys/$DEVPATH/loop ]; then
DESC=$(cat /sys/$DEVPATH/loop/backing_file)
fi
# and for device-mapper
if [ -n "$DM_NAME" ]; then
DESC="$DM_NAME"
fi
# Get lock only in dom0 - there are so many block devices so it causes xenstore
# deadlocks sometimes.

View File

@ -11,7 +11,7 @@ KERNEL=="xvda|xvdb|xvdc*|xvdd", ENV{UDISKS_IGNORE}="1"
ENV{MAJOR}=="202", GOTO="qubes_block_end"
# Skip device-mapper devices
ENV{MAJOR}=="253", GOTO="qubes_block_end"
ENV{MAJOR}=="253", ENV{DM_NAME}=="snapshot-*", 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"