udev rules make it impossible to deactivate lvm volume group with vgchange -an
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lvm2 (Ubuntu) |
Confirmed
|
High
|
Dimitri John Ledkov | ||
udev (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Running 'vgchange -a n volume_group_name' generates udev events that are matched by /lib/udev/
* run 'cryptsetup luksClose' on the underlying encrypted device
* safely remove a removable drive containing an LVM physical volume
* safely use dd to copy the LVM partition to another device (LVM might be writing data)
I turned up logging and it looks like the following happened to the instance I was watching:
1. 'vgchange -a n vgname' caused LVM to close /dev/dm-5 (the LUKS dm device holding the LVM physical volume)
2. udev logged this: device /dev/dm-5 closed, synthesising 'change'
3. a new 'change' 'block' udev event was enqueued for the LUKS dm device
4. udev started processing the new 'change' event
5. the event matched /lib/udev/
6. all of the conditions for /lib/udev/
Brainstorming ideas for fixing this:
* I'm not sure why udev synthesizes a change event when a dm device is closed, but disabling that bit of code should fix this bug (and probably cause many worse bugs).
* Maybe the lvm udev rule should condition on ACTION=="add" instead of ACTION="add|change" (just tried this and unfortunately it doesn't work -- unlocking a LUKS device causes two back-to-back udev events: one 'add' event that only appears to match /lib/udev/
Other info:
$ lsb_release -rdc
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal
lvm2 version: 2.02.95-4ubuntu1
udev version: 175-0ubuntu13
affects: | udev (Ubuntu) → lvm2 (Ubuntu) |
tags: | added: quantal raring |
Status changed to 'Confirmed' because the bug affects multiple users.