@@ -775,7 +775,7 @@ cli_del_maps (void *v, struct strbuf *reply, void *data)
condlog(2, "remove maps (operator)");
vector_foreach_slot(vecs->mpvec, mpp, i) {
- if (flush_map(mpp, vecs, 0))
+ if (flush_map(mpp, vecs))
ret++;
else
i--;
@@ -583,12 +583,11 @@ int update_multipath (struct vectors *vecs, char *mapname)
static bool
flush_map_nopaths(struct multipath *mpp, struct vectors *vecs) {
- char alias[WWID_SIZE];
+ int r;
/*
* flush_map will fail if the device is open
*/
- strlcpy(alias, mpp->alias, WWID_SIZE);
if (mpp->flush_on_last_del == FLUSH_ENABLED) {
condlog(2, "%s Last path deleted, disabling queueing",
mpp->alias);
@@ -598,11 +597,20 @@ flush_map_nopaths(struct multipath *mpp, struct vectors *vecs) {
mpp->stat_map_failures++;
dm_queue_if_no_path(mpp, 0);
}
- if (!flush_map(mpp, vecs, 1)) {
- condlog(2, "%s: removed map after removing all paths", alias);
- return true;
+ r = dm_flush_map_nopaths(mpp->alias, mpp->deferred_remove);
+ if (r) {
+ if (r == 1)
+ condlog(0, "%s: can't flush", mpp->alias);
+ else {
+ condlog(2, "%s: devmap deferred remove", mpp->alias);
+ mpp->deferred_remove = DEFERRED_REMOVE_IN_PROGRESS;
+ }
+ return false;
}
- return false;
+
+ condlog(2, "%s: map flushed after removing all paths", mpp->alias);
+ remove_map_and_stop_waiter(mpp, vecs);
+ return true;
}
static void
@@ -778,30 +786,15 @@ sync_maps_state(vector mpvec)
}
int
-flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
+flush_map(struct multipath * mpp, struct vectors * vecs)
{
- int r;
-
- if (nopaths)
- r = dm_flush_map_nopaths(mpp->alias, mpp->deferred_remove);
- else
- r = dm_flush_map(mpp->alias);
- /*
- * clear references to this map before flushing so we can ignore
- * the spurious uevent we may generate with the dm_flush_map call below
- */
+ int r = dm_flush_map(mpp->alias);
if (r) {
- if (r == 1)
- condlog(0, "%s: can't flush", mpp->alias);
- else {
- condlog(2, "%s: devmap deferred remove", mpp->alias);
- mpp->deferred_remove = DEFERRED_REMOVE_IN_PROGRESS;
- }
+ condlog(0, "%s: can't flush", mpp->alias);
return r;
}
- else
- condlog(2, "%s: map flushed", mpp->alias);
+ condlog(2, "%s: map flushed", mpp->alias);
remove_map_and_stop_waiter(mpp, vecs);
return 0;
@@ -956,7 +949,7 @@ ev_remove_map (char * devname, char * alias, int minor, struct vectors * vecs)
mpp->alias, mpp->dmi.minor, minor);
return 1;
}
- return flush_map(mpp, vecs, 0);
+ return flush_map(mpp, vecs);
}
static void
@@ -40,7 +40,7 @@ int ev_add_path (struct path *, struct vectors *, int);
int ev_remove_path (struct path *, struct vectors *, int);
int ev_add_map (char *, const char *, struct vectors *);
int ev_remove_map (char *, char *, int, struct vectors *);
-int flush_map(struct multipath *, struct vectors *, int);
+int flush_map(struct multipath *, struct vectors *);
void handle_signals(bool);
int refresh_multipath(struct vectors * vecs, struct multipath * mpp);