return 1;
}
+extern int
+dm_suspend_and_flush_map (const char * mapname)
+{
+ int s;
+
+ if (!dm_map_present(mapname))
+ return 0;
+
+ if (dm_type(mapname, TGT_MPATH) <= 0)
+ return 0; /* nothing to do */
+
+ s = dm_queue_if_no_path((char *)mapname, 0);
+ if (!s)
+ s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0);
+
+ if (!dm_flush_map(mapname)) {
+ condlog(4, "multipath map %s removed", mapname);
+ return 0;
+ }
+ condlog(2, "failed to remove multipath map %s", mapname);
+ dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname);
+ return 1;
+}
+
extern int
dm_flush_maps (void)
{
goto out;
do {
- r |= dm_flush_map(names->name);
+ r |= dm_suspend_and_flush_map(names->name);
next = names->next;
names = (void *) names + next;
} while (next);
int _dm_flush_map (const char *, int);
#define dm_flush_map(mapname) _dm_flush_map(mapname, 1)
#define dm_flush_map_nosync(mapname) _dm_flush_map(mapname, 0)
+int dm_suspend_and_flush_map(const char * mapname);
int dm_flush_maps (void);
int dm_fail_path(char * mapname, char * path);
int dm_reinstate_path(char * mapname, char * path);
goto out;
}
if (conf->remove == FLUSH_ONE) {
- if (conf->dev_type == DEV_DEVMAP)
- r = dm_flush_map(conf->dev);
- else
+ if (conf->dev_type == DEV_DEVMAP) {
+ r = dm_suspend_and_flush_map(conf->dev);
+ } else
condlog(0, "must provide a map name to remove");
goto out;