From 1c49c790c50452564b7319b2a427462ad266793f Mon Sep 17 00:00:00 2001 From: renmingshuai Date: Thu, 28 Jan 2021 22:26:58 +0800 Subject: [PATCH 07/15] fix lun expansion failure when there is offline path --- libmultipath/configure.c | 10 ++++++++++ libmultipath/structs_vec.c | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libmultipath/configure.c b/libmultipath/configure.c index fdf8005..84a246b 100644 --- a/libmultipath/configure.c +++ b/libmultipath/configure.c @@ -1187,6 +1187,13 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, orphan_path(pp1, "only one path"); continue; } + + /* if path is offline */ + if (pp1->state == PATH_DOWN) { + orphan_path(pp1, "skip offline path"); + continue; + } + /* if path is handled before */ if (pp1->handled) { condlog(3, "%s: skip handled path.", pp1->dev_t); @@ -1219,6 +1226,9 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid, if (strcmp(pp1->wwid, pp2->wwid)) continue; + if (!pp2->size || pp2->state == PATH_DOWN) + continue; + if (!mpp->size && pp2->size) mpp->size = pp2->size; diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c index 8170150..adc034b 100644 --- a/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c @@ -722,8 +722,9 @@ int verify_paths(struct multipath *mpp) /* * see if path is in sysfs */ - if (!pp->udev || sysfs_attr_get_value(pp->udev, "dev", - pp->dev_t, BLK_DEV_SIZE) < 0) { + if (!pp->udev || (sysfs_attr_get_value(pp->udev, "dev", + pp->dev_t, BLK_DEV_SIZE) < 0) || + (pp->state == PATH_DOWN && pp->size != mpp->size)) { if (pp->state != PATH_DOWN) { condlog(1, "%s: removing valid path %s in state %d", mpp->alias, pp->dev, pp->state); -- 1.8.3.1