Comment 9 for bug 585027

Revision history for this message
Peter Petrakis (peter-petrakis) wrote :

@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.