On Sat, 7 Jun 2008, Guido Günther wrote:
On Fri, Jun 06, 2008 at 10:33:36PM +0100, Tim Woodall wrote:
The /etc/udev/rules.d/multipath.rules exposes a race that causes LVM
snapshots to fail to be created intermittently.
You mean:
# take care of devmap partitioning
ACTION=="add", SUBSYSTEM=="block", KERNEL=="dm-*", \
PROGRAM="/sbin/dmsetup -j %M -m %m --noopencount --noheadings -c
-o name info", \
RUN+="/sbin/kpartx -a /dev/mapper/%c"
Does changing ACTION="add" into ACTION="change" do any good?
Yes. That seems to fix my LVM problem.
I'm using the following simple test script:
feynman:~# cat testlvm
#!/bin/bash
for i in $( seq 1 10 ); do
/sbin/lvcreate -A n -L500M -s -nroot-backup /dev/vg0/root
sleep 2
/sbin/lvremove -A n -f /dev/vg0/root-backup
sleep 2
done
exit 0
With the ACTION=="add" a typical run looks like this: (note that the
machine has to be idle. If there's lots of disk access then the LVM
snapshot seems to work regardless)
feynman:~# ./testlvm
Logical volume "root-backup" created
Logical volume "root-backup" successfully removed
Logical volume "root-backup" created
Logical volume "root-backup" successfully removed
Logical volume "root-backup" created
Logical volume "root-backup" successfully removed
Logical volume "root-backup" created
Logical volume "root-backup" successfully removed
LV vg0/root-backup in use: not deactivating
Couldn't deactivate new snapshot.
Logical volume "root-backup" successfully removed
Logical volume "root-backup" created
Logical volume "root-backup" successfully removed
LV vg0/root-backup in use: not deactivating
Couldn't deactivate new snapshot.
Logical volume "root-backup" successfully removed
LV vg0/root-backup in use: not deactivating
Couldn't deactivate new snapshot.
Logical volume "root-backup" successfully removed
LV vg0/root-backup in use: not deactivating
Couldn't deactivate new snapshot.
Logical volume "root-backup" successfully removed
Logical volume "root-backup" created
Logical volume "root-backup" successfully removed
I've never had fewer than 2 failures (20%) running this script with the
multipath.rules script when the machine is idle.
With the add replaced with change, or the udev rule removed completely I've
never seen a failure.
Do you have a chance to try the packages from lenny? Kpartx is split out
into a separate package there and the udev rules are much more robust.
There are packports of this versions available here:
http://debian.bzed.de/etch-backports/devmapper_1.02.24-4~bpo40+1.dsc
http://debian.bzed.de/etch-backports/multipath-tools_0.4.8-7~bpo40+1.dsc
Not easily on this machine. But I can probably test on another machine
if it would help you.
Note that I've not tested if that add->change breaks anything else. I'm
not even sure how to test this udev rule.
Tim.
--
God said, "div D = rho, div B = 0, curl E = - @B/@t, curl H = J + @D/@t,"
and there was light.
http://www.woodall.me.uk/ http://www.locofungus.btinternet.co.uk/