multipathd: update path group prio in check_path
authorMartin Wilck <mwilck@suse.com>
Mon, 5 Mar 2018 23:15:06 +0000 (00:15 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Wed, 7 Mar 2018 09:40:14 +0000 (10:40 +0100)
The previous patch "libmultipath: don't update path groups when printing"
removed the call to path_group_prio_update() in the printing code path.
To compensate for that, recalculate path group prio also when it's not
strictly necessary (i.e. if failback "manual" is set).

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

index 9d458dd..97c5f70 100644 (file)
@@ -252,8 +252,9 @@ need_switch_pathgroup (struct multipath * mpp, int refresh)
        struct path * pp;
        unsigned int i, j;
        struct config *conf;
+       int bestpg;
 
-       if (!mpp || mpp->pgfailback == -FAILBACK_MANUAL)
+       if (!mpp)
                return 0;
 
        /*
@@ -272,8 +273,11 @@ need_switch_pathgroup (struct multipath * mpp, int refresh)
        if (!mpp->pg || VECTOR_SIZE(mpp->paths) == 0)
                return 0;
 
-       mpp->bestpg = select_path_group(mpp);
+       bestpg = select_path_group(mpp);
+       if (mpp->pgfailback == -FAILBACK_MANUAL)
+               return 0;
 
+       mpp->bestpg = bestpg;
        if (mpp->bestpg != mpp->nextpg)
                return 1;