[Bug 585027] Re: Race condition with dmsetup causes 'map already present' messages

Peter Petrakis peter.petrakis at canonical.com
Mon Jul 9 16:33:25 UTC 2012


@Alasdair

It's buried in the description:

"We were attempting variants of 'while true; do sudo multipath -F; sudo
multipath -v4 ; done' to create a set of udev add/remove events and
noticed that shortly after starting, no output appeared within the
'udevadm monitor' command."

So it appears that multipath is sending a DM ioctl to create a map with the same wwid,
that "should" have been completely removed at the exit of 'multipath -F'. There's
no dmsetup command executing out of band unless there's some udev rule misbehaving.

The udev rules managing dmsetup are /lib/udev/rules.d/55-dm.rules

I'm not familiar with the cookie feature you mentioned, but we appear to have some of the
capability here. I haven't compared it to upstream yet.

"55-dm.rules"

# Decode udev control flags and set environment variables appropriately.
# These flags are encoded in DM_COOKIE variable that was introduced in
# kernel version 2.6.31. Therefore, we can use this feature with
# kernels >= 2.6.31 only.
ENV{DM_COOKIE}=="?*", IMPORT{program}="/sbin/dmsetup udevflags $env{DM_COOKIE}"
ENV{DM_COOKIE}=="?*", RUN+="/sbin/dmsetup udevcomplete $env{DM_COOKIE}"

and compared to our packaged source in precise:

<12:29:34>multipath-tools-0.4.9$ grep -R cookie .
./kpartx/devmapper.c:dm_simplecmd (int task, const char *name, int no_flush, uint32_t *cookie) {
./kpartx/devmapper.c:	if (udev_wait_flag && !dm_task_set_cookie(dmt, cookie, 0))
./kpartx/devmapper.c:	   mode_t mode, uid_t uid, gid_t gid, uint32_t *cookie) {
./kpartx/devmapper.c:	if (task == DM_DEVICE_CREATE && !dm_task_set_cookie(dmt, cookie, 0))
./kpartx/kpartx.c:	uint32_t cookie = 0;
./kpartx/kpartx.c:						  0, &cookie)) {
./kpartx/kpartx.c:					       buf.st_gid, &cookie)) {
./kpartx/kpartx.c:						  1, &cookie)) {
./kpartx/kpartx.c:						  &cookie);
./kpartx/kpartx.c:							     &cookie);
./kpartx/kpartx.c:	dm_udev_wait(cookie);
./libmultipath/config.h:	uint32_t cookie;
./libmultipath/devmapper.c:	if (udev_wait_flag && !dm_task_set_cookie(dmt, &conf->cookie, 0))
./libmultipath/devmapper.c:	    !dm_task_set_cookie(dmt, &conf->cookie, 0))
./libmultipath/devmapper.c:	if (!dm_task_set_cookie(dmt, &conf->cookie, 0))
./multipath/main.c:	dm_udev_wait(conf->cookie);

This cookie mechanism is news to me, I'll take a closer look, thanks.

-- 
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to multipath-tools in Ubuntu.
https://bugs.launchpad.net/bugs/585027

Title:
  Race condition with dmsetup causes 'map already present' messages

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/multipath-tools/+bug/585027/+subscriptions



More information about the Ubuntu-server-bugs mailing list