Check for valid DM_DEVICE_INFO before proceeding

Calling 'DM_DEVICE_INFO' might succeed but the returned context
might refer to an invalid device. So one needs to check the 'exists'
field to avoid this.

References: bnc#888453

Signed-off-by: Hannes Reinecke <hare@suse.de>
Fixup hang during bootup

Some systems might hang during bootup as multipath is not started
correctly. This might be due to not all events being processed
prior to multipath startup.

References: bnc#750110

Signed-off-by: Hannes Reinecke <hare@suse.de.
Use a default dev_loss_tmo of 600

If no dev_loss_tmo is specified use the default of '600'.

References: bnc#889927

Signed-off-by: Hannes Reinecke <hare@suse.de>
Allow for empty SCSI revision

Some (broken) SCSI devices return an empty SCSI revision, but
this doesn't indicate a broken device. So allow for an empty
revision string when discover devices.

References: bnc#889614

Signed-off-by: Hannes Reinecke <hare@suse.de>
Ignore devices when sysfs_get_tgt_nodename fails

If sysfs_get_tgt_nodename fails we should not try to use this
device.

References: bnc#885395

Signed-off-by: Hannes Reinecke <hare@suse.de>
Skip USB devices during discovery

Some USB devices even present VPD pages, but they still remain
USB devices, and we shouldn't run multipath on those.
So detect USB devices properly and skip them during discovery.

References: bnc#865577

Signed-off-by: Hannes Reinecke <hare@suse.de>
Revert commit 'Blacklist HP Virtual devices'

Adding a default blacklist for all HP devices would obscure all
earlier entries, leading to unwanted behaviour.

References: bnc#885395

Signed-off-by: Hannes Reinecke <hare@suse.de>
- Update Changelog.
Fixup device-mapper 'cookie' handling

device-mapper has a 'cookie', which is inserted with the ioctl
for modifying device-mapper devices.
It is used as a synchronization point between udev and any other
applications to notify the latter when udev has finished
processing the event.
Originally multipath would only use a single cookie for every
transaction, and wait for that cookie at the end of the program.
Which works well if you only have one transaction, but for several
(like calling 'multipath') it will actually overwrite the cookie
and fail to wait for earlier events.
This causes libdevmapper to create the device nodes on its own,
and the device nodes not being handled by udev.

References: bnc#886743

Signed-off-by: Hannes Reinecke <hare@suse.de>
Remove udev wrapper functions

All functions have been encapsulated by ifdef, so there is no
need to carry udev wrapper functions anymore.

Signed-off-by: Hannes Reinecke <hare@suse.de>
- Update Changelog.
signal waiter thread to stop waiting on dm events

The ioctl syscall is not a pthread cancellation point. So, when
device-mapper is waiting on events, pthread_cancel won't cancel
the waiter thread.  This patch makes the waiter threads handle
SIGUSR2, and has stop_waiter_thread() signal it to break out of
waiting on dm events. Unfortunately, there is still a possibility
of the signal arriving before the ioctl, and the waiter thread
still hanging until the devices are reloaded.

References: bnc#896910

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
- Update Changelog.