[dm-devel] [PATCH v2 1/1] libmultipath: fix false removes in dmevents polling code

Martin Wilck mwilck at suse.de
Mon Dec 3 10:05:07 UTC 2018


On Thu, 2018-11-29 at 16:26 -0600,  Benjamin Marzinski  wrote:
> dm_is_mpath() would return 0 if either a device was not a multipath
> device or if the libdevmapper command failed. Because dm_is_mpath()
> didn't distinguish between these situations, dm_get_events() could
> assume that a device was not really a multipath device, when in fact
> it
> was, and the libdevmapper command simply failed. This would cause the
> dmevents polling waiter to stop monitoring the device.
> 
> In reality, the call to dm_is_mpath() isn't necessary, because
> dm_get_events() will already verify that the device name is on the
> list
> of devices to wait for. However, if there are a large number of
> non-multipath devices on the system, ignoring them can be
> useful.  Thus,
> if dm_is_mpath() successfully runs the libdevmapper command and
> verifies
> that the device is not a multipath device, dm_get_events() should
> skip
> it. But if the libdevmapper command fails, dm_get_events() should
> still
> check the device list, to see if the device should be monitored.
> 
> This commit makes dm_is_mpath() return -1 for situations where
> the libdevmapper command failed, and makes dm_get_events() only
> ignore
> the device on a return of 0.
> 
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>

Reviewed-by: Martin Wilck <mwilck at suse.com>

> ---
>  libmpathpersist/mpath_persist.c |  4 ++--
>  libmultipath/devmapper.c        | 41 +++++++++++++++++++++++++++++
> ------------
>  multipath/main.c                |  2 +-
>  multipathd/dmevents.c           |  8 ++++++--
>  multipathd/main.c               |  2 +-
>  5 files changed, 39 insertions(+), 18 deletions(-)




More information about the dm-devel mailing list