multipathd: use update_path_groups instead of reload_map
authorBenjamin Marzinski <bmarzins@redhat.com>
Sat, 30 Mar 2019 06:05:58 +0000 (01:05 -0500)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 18 Apr 2019 11:03:39 +0000 (13:03 +0200)
reload_map() doesn't do the work to sync the state after reloading the
map.  Instead of calling it directly, cli_reload() and uev_update_path()
should call update_path_groups(), which calls reload_map() with all the
necessary syncing.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
multipathd/cli_handlers.c
multipathd/main.c
multipathd/main.h

index f95813e..60e17d6 100644 (file)
@@ -877,7 +877,7 @@ cli_reload(void *v, char **reply, int *len, void *data)
                return 1;
        }
 
-       return reload_map(vecs, mpp, 0, 1);
+       return update_path_groups(mpp, vecs, 0);
 }
 
 int resize_map(struct multipath *mpp, unsigned long long size,
index fd83a6a..7a317d9 100644 (file)
@@ -1273,10 +1273,13 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
                        else {
                                if (ro == 1)
                                        pp->mpp->force_readonly = 1;
-                               retval = reload_map(vecs, mpp, 0, 1);
-                               pp->mpp->force_readonly = 0;
-                               condlog(2, "%s: map %s reloaded (retval %d)",
-                                       uev->kernel, mpp->alias, retval);
+                               retval = update_path_groups(mpp, vecs, 0);
+                               if (retval == 2)
+                                       condlog(2, "%s: map removed during reload", pp->dev);
+                               else {
+                                       pp->mpp->force_readonly = 0;
+                                       condlog(2, "%s: map %s reloaded (retval %d)", uev->kernel, mpp->alias, retval);
+                               }
                        }
                }
        }
@@ -1832,7 +1835,7 @@ int update_path_groups(struct multipath *mpp, struct vectors *vecs, int refresh)
 
        dm_lib_release();
        if (setup_multipath(vecs, mpp) != 0)
-               return 1;
+               return 2;
        sync_map_state(mpp);
 
        return 0;
index 8fd426b..e5c1398 100644 (file)
@@ -43,5 +43,7 @@ int __setup_multipath (struct vectors * vecs, struct multipath * mpp,
                       int reset);
 #define setup_multipath(vecs, mpp) __setup_multipath(vecs, mpp, 1)
 int update_multipath (struct vectors *vecs, char *mapname, int reset);
+int update_path_groups(struct multipath *mpp, struct vectors *vecs,
+                      int refresh);
 
 #endif /* MAIN_H */