libmultipath: get_prio(): don't reset prio for inaccessible paths
authorMartin Wilck <mwilck@suse.com>
Thu, 11 Apr 2019 10:49:23 +0000 (12:49 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Fri, 19 Apr 2019 13:37:43 +0000 (15:37 +0200)
commitebbb56f28d56816423133b3d679b658c725c4685
tree789a6e35f3324be5bfda002b7af5416064e7c3f3
parent656fc30e9baf9f92654b273c9ac4d1fcf86705dd
libmultipath: get_prio(): don't reset prio for inaccessible paths

pathinfo() doesn't call get_prio() if a path is down, now keeping the old
priority value. But if a path becomes inaccessible between the state check
and the get_prio() call, retrieving the priority will likely fail, and the
path priority will be reset to PRIO_UNDEF. This makes it timing-dependent
how the priority of a failed path is treated. Fix that by checking the path
state in get_prio() if an error occurs, and not touching pp->priority if
the path is in inaccessible state. A checker_check() call would be too
much here, but a quick path_offline() check seems appropriate.

Keep the previous behavior for the case where getting the priority fails
although the path is apparently healthy. This is presumably a very rare
condition, in which it seems actually wrong to preserve the old prio value.

Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/discovery.c