junneyang / zumastor

Automatically exported from code.google.com/p/zumastor
0 stars 1 forks source link

'dmsetup remove' fails on Gusty when it is run immediately after the device is created #78

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The bug was first reported by Pau Garcia i Quiles and was introduced in
Ubuntu 7.1, device mapper 1.02.20. This seems a device mapper bug and is
caused by the dmsetup udev rule added in Gusty. Basically, when a device
mapper device is created, the kernel generates a udevent. Receiving this
device event, udev matches it to the corresponding configuration rule.
According to the rule, udev creates several symlinks under /dev/disk.
During this process, udev calls vol_id to get uuid etc. The problem is
vol_id runs asynchronously from 'dmsetup create'. So if we remove the
device immediately, we get 'Device busy' error.

We plan to have a simple sleep-retry fix in zumastor remove_device code for
0.7 release. Meanwhile, we will post the bug and possibly a fix patch on
linux-lvm mailing list.

Original issue reported on code.google.com by jiahotc...@gmail.com on 20 Feb 2008 at 8:40

GoogleCodeExporter commented 9 years ago
Here is the proposed quick fix for zumastor:

Index: zumastor/lib/zumastor/common
===================================================================
--- zumastor/lib/zumastor/common        (revision 1408)
+++ zumastor/lib/zumastor/common        (working copy)
@@ -440,7 +440,13 @@ function remove_device {
        local -r name=$(volume_name $vol $id)
        local output

-       dmsetup remove $name || return 1
+       # return if the device does not exist
+       dmsetup info $name >& /dev/null || return 0
+       for i in `seq 5`; do
+               dmsetup remove $name && return 0
+               sleep 1
+       done
+       return 1
 }

 function umount_remove_device {

Original comment by jiahotc...@gmail.com on 20 Feb 2008 at 11:35

GoogleCodeExporter commented 9 years ago
Looks good.  Please add a comment in the code linking to the issue
this fixes, and commit.

Original comment by daniel.r...@gmail.com on 20 Feb 2008 at 11:43

GoogleCodeExporter commented 9 years ago
Fixed by r1411, I believe.

Original comment by daniel.r...@gmail.com on 26 Feb 2008 at 12:48