Details
Description
Hi,
I'm currently tracking bugs while taking snapshots of running vm every night on a LVM backend storage with multipath (seeĀ XSO-855)
I noticed that mpathcount service was running on every change of a SR. In my case, it coould run more thant 500 times during a nightly backup. In some case, it could break the lvm command running on a sr and induce a lvm metadata corruption (only 2 processes were running at this time : a lvm command and mpathcount.py).
Mpathcount should not run at every sr change and should run only while there is a real multiipath activity.
This is a patched version I'm currently testing to limit unnecessary mpathcount invocations (/etc/udev/rules.d/40-multipath.rules) :
SUBSYSTEM!="block", GOTO="end_mpath" KERNEL!="dm-*", GOTO="end_mpath" ACTION=="add", PROGRAM=="/bin/bash -c '/sbin/dmsetup info -c -o name --noheadings -j %M -m %m | /bin/grep VG_XenStorage'", GOTO="end_mpath" ACTION=="add", PROGRAM=="/bin/bash -c '/sbin/dmsetup info -c -o name --noheadings -j %M -m %m | /bin/grep XSLocalEXT'", GOTO="end_mpath" ACTION=="add|change", PROGRAM=="/sbin/dmsetup info -c -o name --noheadings -j %M -m %m", RESULT=="?*", SYMLINK+="disk/by-scsid/%c/mapper" ACTION=="change", PROGRAM!="/sbin/dmsetup info -c --noheadings -j %M -m %m", GOTO="end_mpath" PROGRAM!="/sbin/dmsetup info -c -o uuid,name --separator ' ' --noheadings -j %M -m %m", GOTO="end_mpath" RESULT!="mpath-*", GOTO="end_mpath" ENV{DM_ACTION}=="PATH_REINSTATED", GOTO="mpathcount" ENV{DM_ACTION}=="PATH_FAILED", GOTO="mpathcount" GOTO="end_mpath" LABEL="mpathcount" # ENV is necessary otherwise the child process of mpathcount cannot find multipathd executable ACTION=="change", RUN+="/usr/bin/systemctl --no-block start mpcount.service" LABEL="end_mpath"
The logic is to call mpathcount only on event "PATH_REINSTATED" and "PATH_FAILED"...
Regards,
Nicolas Michaux