-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multipathd does not trigger udev rules for a path that the user has added to the wwids file #103
Comments
The classification of paths between multipath-and non-multipath depends on the find_multipaths setting. Note that (But maybe we can short-cut your issue by having @bmarzins comment here). |
@mwilck note that I have not mentioned any use of |
Usage of The expected behavior is that with
(just a very crude example, we usually discourage blacklisting by devnode). Without "greedy", you need to add it to the WWIDs file as you figured out yourself. |
In some cases it is more practical to execute an one-shot command than to use
I would say that this usage is considered supported and should not lead to inconsistencies. And if the udev rules are not triggered and In the meantime I found another way to configure multipath on the device using a one-shot command:
This works properly and triggers the udev rules (presumably because the device is added by multipathd itself?). But as it requires me to know the WWID of the device ( |
0001-libmultipath-always-trigger-uevent-change-when-a-map.patch.txt Can you try with this patch? |
Probably the easiest way to make this work is to just run:
The fact that:
doesn't work is a bug. In "multipathd add map" we assume you are passing in an identifier of a multipath device. In the multipath command, we don't make those assumptions, so multipath figures out that this is a path and you want to make a multipath device out of it. That's an easy fix. |
@mwilck Instead of always setting needs_paths_uevent here, and then checking if it's set in domap() when a create succeeds, wouldn't it be easier to just always call |
Possibly. I haven't thought it through though. Anyway we should be aware that this is not a full solution to the problem of modifying the WWIDs file asynchronously. If we handle |
Thanks, this works in my test 👍 |
Thanks, this works even without the patch, I don't know why I thought that
Would be a nice extension, although the manual page describes the argument as
so it currently behaves as described - I did not really expect |
Thank you for the feedback! I'm not 100% convinced yet that this is the right thing to do. We'll need to do some more code review and testing to verify that we won't generate loads of additional uevents because of this change. I don't think we will, because multipathd only generates events if the state of the path in question does not match its expectations, but we must double-check, because uevent storms are a very bad thing. |
If map creation succeeds, previously not multipathed devices are now multipathed. udev may not have noticed this yet, thus trigger path uevents to make it aware of the situation. Likewise, if creating a map fails, the paths in question were likely considered multipath members by udev, too. They will now be marked as failed, so trigger an event in this situation as well. Fixes: opensvc#103 Suggested-by: Benjamin Marzinski <[email protected]> Signed-off-by: Martin Wilck <[email protected]>
I have posted a patch series to the dm-devel mailing list ("[PATCH v2 0/8] multipath-tools fixes") where patch 6 and 7 are an attempt to fix this issue. I have tested it successfully here, and I am no more worried about excessive uevent storms. With this set, uevents are also triggered if WWIDs are removed from the WWIDs file with The set is also on my tip branch. |
I would like to configure multipath on a device which has only one path (
/dev/sdd
). (This is for testing, but I believe there may be uses for this even in production, e.g. when only one path exists for a device, but one knows that more paths will appear.)I tried to do this via adding the device to the wwids file (
multipath -a /dev/sdd
) and restarting multipathd (systemctl restart multipathd
), which then picks up the device and creates the multipath map (/dev/mapper/mpatha
). This mostly works, but I have encountered an irregularity whereudevadm info
on the path does not show that it is a path:Also, there are still partition device nodes on
/dev/sdd
(they should have been deleted by/usr/lib/udev/rules.d/68-del-part-nodes.rules
):This gets corrected after reboot,
udevadm info
shows the expected results:I found that multipathd configured by using
mpathconf --find_multipaths greedy
picks up the device without usingmultipath -a
and in this case the udev information of the path is immediately correct (without a reboot). I would prefer to have a more fine-grained control over which devices are configured as multipath, though, and this behavior does not look correct.When examining the difference between the two cases, I found that when using
greedy
multipathd emits a change event for/dev/sdd
which then triggers the update of the udev variables and deletion of the partition device nodes, and this does not happen when usingmultipath -a
and then restarting multipathd. (The rule that setsDM_MULTIPATH_DEVICE_PATH
is in/usr/lib/udev/rules.d/62-multipath.rules
.) I then found that usingudevadm trigger -w -c change /dev/sdd
after restarting multipathd corrects everything.While it is nice to have a workaround, I believe that this is a bug and the event should have been emitted by multipathd itself, because a documented use of
multipath
andmultipathd
should not lead to a situation which is apparently inconsistent.I looked into multipath-tools code and found two locations that are most likely related to the problem:
multipath-tools/libmultipath/configure.c
Line 940 in ee3a701
multipath-tools/multipathd/main.c
Line 3087 in ee3a701
Not sure which of them is executed, but both seem to trigger udev on the paths only if the wwid gets newly added to the wwids file, which would explain the behavior (when using
multipath -a
the wwid is already there, withgreedy
it is not - multipathd adds it). If that's the case, what is the reason for this behavior?This is on RHEL 8 and RHEL 9 btw (multipath tools version 0.8.4 and 0.8.7).
The text was updated successfully, but these errors were encountered: