Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1056976 - Improve the way the mpath handles path failure/reinstatement to avoid extra processing for any device stack layered on top
Summary: Improve the way the mpath handles path failure/reinstatement to avoid extra p...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: device-mapper-multipath
Version: 7.0
Hardware: All
OS: Linux
high
medium
Target Milestone: rc
: ---
Assignee: Ben Marzinski
QA Contact: yanfu,wang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-23 09:38 UTC by Peter Rajnoha
Modified: 2014-06-18 05:15 UTC (History)
8 users (show)

Fixed In Version: device-mapper-multipath-0.4.9-63.el7
Doc Type: Bug Fix
Doc Text:
Cause: Multipath wasn't signalling when it reloaded the device because of a path change. Consequence: Other udev rules would process events that were internal to multipath, wasting time and occasionally dropping events Fix: Multipath now sets a udev environment variable flag when for actions that cause uevents that can be safely ignored by other udev rules. Result: Other rules do not process events that are internal to multipath, keeping udev from slowing down, and occasionally dropping events
Clone Of:
Environment:
Last Closed: 2014-06-13 11:00:35 UTC


Attachments (Terms of Use)
udev rules for better PATH_FAILED/PATH_REINSTATED mpath uevent handling (deleted)
2014-01-23 09:43 UTC, Peter Rajnoha
no flags Details
patch to make it possible to recognize reload event - mark it with a proper udev flag (deleted)
2014-01-23 09:45 UTC, Peter Rajnoha
no flags Details | Diff

Description Peter Rajnoha 2014-01-23 09:38:28 UTC
The event is always generated on the DM_DEVICE_RESUME ioctl call. However, both reload and create event contains this event. Make it possible to recognize reload events (DM_DEVICE_RELOAD + DM_DEVICE_RESUME) from creation events (DM_DEVICE_CREATE + DM_DEVICE_RELOAD + DM_DEVICE_RESUME).

Once we can recognize these two events in udev rules, we can optimize udev handling in a way to avoid extra event processing when not actually needed - e.g. in case the path fail and get reinstated and multipath issues a reload. For any device stack layered on top of such mpath device, it makes no difference since multipath takes care of these situations in a transparent way so that the device is kept usable (as long as at least on path is available).

This requires patching both userspace multipath code as well as adding specific udev rules that handle this situation (reacting to DM_ACTION="PATH_FAILED|PATH_REINSTATED" events).

This will make it possible to optimize event handling and also resolve some problems that arise because of high number of events being processed if there's any device stack on top of the mpath (see also bug #1049387).

Comment 1 Peter Rajnoha 2014-01-23 09:43:01 UTC
Created attachment 854268 [details]
udev rules for better PATH_FAILED/PATH_REINSTATED mpath uevent handling

Comment 2 Peter Rajnoha 2014-01-23 09:45:04 UTC
Created attachment 854270 [details]
patch to make it possible to recognize reload event - mark it with a proper udev flag

Comment 4 Ben Marzinski 2014-01-29 22:08:10 UTC
Patches applied. Thanks.

Comment 6 Ben Marzinski 2014-01-31 03:30:53 UTC
To test this, you need to create a multipath device with multiple paths. As paths are added and removed, and failed and restored, you need to either watch the udev events with

# udevadm monitor --udev --property

or check the udev database with

# udevadm info --export-db

DM_NR_VALID_PATHS should match the number of working paths. if DM_NR_VALID_PATH=0, DM_SCAN should also equal 0.

Finally, on events that are just caused from reloads where paths are added or removed, you should see DM_ACTIVATION=0

Comment 8 yanfu,wang 2014-02-14 04:13:14 UTC
# multipath -ll
mpathb (353333330000007d0) dm-3 Linux   ,scsi_debug      
size=8.0M features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 6:0:0:0 sdb 8:16 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  `- 7:0:0:0 sdc 8:32 active ready running

When I failed the two paths one by one, I could see the DM_NR_VALID_PATHS number changed:
# udevadm monitor --udev --property
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing

UDEV  [3925.263148] change   /devices/virtual/block/dm-3 (block)
ACTION=change
DEVLINKS=/dev/disk/by-id/dm-name-mpathb /dev/disk/by-id/dm-uuid-mpath-353333330000007d0 /dev/mapper/mpathb
DEVNAME=/dev/dm-3
DEVPATH=/devices/virtual/block/dm-3
DEVTYPE=disk
DM_ACTION=PATH_FAILED
DM_MULTIPATH_TIMESTAMP=1392349691
DM_NAME=mpathb
DM_NR_VALID_PATHS=1
DM_PATH=8:16
DM_SEQNUM=1
DM_SUSPENDED=0
DM_TARGET=multipath
DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1
DM_UDEV_PRIMARY_SOURCE_FLAG=1
DM_UDEV_RULES_VSN=2
DM_UUID=mpath-353333330000007d0
MAJOR=253
MINOR=3
MPATH_SBIN_PATH=/sbin
SEQNUM=1990
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=927246

UDEV  [4027.393124] change   /devices/virtual/block/dm-3 (block)
ACTION=change
DEVLINKS=/dev/disk/by-id/dm-name-mpathb /dev/disk/by-id/dm-uuid-mpath-353333330000007d0 /dev/mapper/mpathb
DEVNAME=/dev/dm-3
DEVPATH=/devices/virtual/block/dm-3
DEVTYPE=disk
DM_ACTION=PATH_FAILED
DM_MULTIPATH_TIMESTAMP=1392349691
DM_NAME=mpathb
DM_NOSCAN=1
DM_NR_VALID_PATHS=0
DM_PATH=8:32
DM_SEQNUM=2
DM_SUSPENDED=0
DM_TARGET=multipath
DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1
DM_UDEV_DISABLE_OTHER_RULES_FLAG=1
DM_UDEV_PRIMARY_SOURCE_FLAG=1
DM_UDEV_RULES_VSN=2
DM_UUID=mpath-353333330000007d0
MAJOR=253
MINOR=3
MPATH_SBIN_PATH=/sbin
SEQNUM=1991
SUBSYSTEM=block
SYSTEMD_READY=0
TAGS=:systemd:
USEC_INITIALIZED=927246

When I reload multipath configuration by run 'multipath -r', I could see DM_ACTIVATION=0:
UDEV  [4235.281162] change   /devices/virtual/block/dm-3 (block)
ACTION=change
DEVLINKS=/dev/disk/by-id/dm-name-mpathb /dev/disk/by-id/dm-uuid-mpath-353333330000007d0 /dev/mapper/mpathb
DEVNAME=/dev/dm-3
DEVPATH=/devices/virtual/block/dm-3
DEVTYPE=disk
DM_ACTIVATION=0
DM_COOKIE=21025482
DM_MULTIPATH_TIMESTAMP=1392349691
DM_NAME=mpathb
DM_SUBSYSTEM_UDEV_FLAG0=1
DM_SUSPENDED=0
DM_UDEV_PRIMARY_SOURCE_FLAG=1
DM_UDEV_RULES_VSN=2
DM_UUID=mpath-353333330000007d0
MAJOR=253
MINOR=3
MPATH_SBIN_PATH=/sbin
SEQNUM=2008
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=927246

@Ben, just one question want to confirm with you, instead of 'DM_SCAN should also equal 0' you mentioned, DM_NOSCAN=1 in fact during testing. But I think It's OK too, right?

Comment 9 Peter Rajnoha 2014-02-14 08:53:00 UTC
Yes, if ther(In reply to yanfu,wang from comment #8)
> @Ben, just one question want to confirm with you, instead of 'DM_SCAN should
> also equal 0' you mentioned, DM_NOSCAN=1 in fact during testing. But I think
> It's OK too, right?

Yes, indeed - whenever the number of valid paths drop to 0, the DM_NOSCAN=1 should be set. That was just a typo before...

Comment 10 yanfu,wang 2014-02-14 09:37:57 UTC
(In reply to Peter Rajnoha from comment #9)
> Yes, if ther(In reply to yanfu,wang from comment #8)
> > @Ben, just one question want to confirm with you, instead of 'DM_SCAN should
> > also equal 0' you mentioned, DM_NOSCAN=1 in fact during testing. But I think
> > It's OK too, right?
> 
> Yes, indeed - whenever the number of valid paths drop to 0, the DM_NOSCAN=1
> should be set. That was just a typo before...

Thanks for the confirmation, change to verify now.

Comment 11 Ludek Smid 2014-06-13 11:00:35 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.