X-Git-Url: https://git.opensvc.com/gitweb.cgi?p=multipath-tools%2F.git;a=blobdiff_plain;f=libmultipath%2Fdevmapper.c;h=4c8b923e1d2731f64df089a229282591b3d75f46;hp=69f475ca180002fbc524e5b46d2953dbdc77f914;hb=7202dd518f55affdb231c6c355d56accba22ef95;hpb=5a5f078c7aa2e382ed933c8768cf256ce01237a9 diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c index 69f475ca..4c8b923e 100644 --- a/libmultipath/devmapper.c +++ b/libmultipath/devmapper.c @@ -366,7 +366,7 @@ out: } extern int -dm_get_map(char * name, unsigned long long * size, char * outparams) +dm_get_map(const char * name, unsigned long long * size, char * outparams) { int r = 1; struct dm_task *dmt; @@ -685,7 +685,9 @@ _dm_flush_map (const char * mapname, int need_sync) extern int dm_suspend_and_flush_map (const char * mapname) { - int s; + int s = 0, queue_if_no_path = 0; + unsigned long long mapsize; + char params[PARAMS_SIZE] = {0}; if (!dm_map_present(mapname)) return 0; @@ -693,8 +695,17 @@ dm_suspend_and_flush_map (const char * mapname) if (dm_type(mapname, TGT_MPATH) <= 0) return 0; /* nothing to do */ - s = dm_queue_if_no_path((char *)mapname, 0); - if (!s) + if (!dm_get_map(mapname, &mapsize, params)) { + if (strstr(params, "queue_if_no_path")) + queue_if_no_path = 1; + } + + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 0); + /* Leave queue_if_no_path alone if unset failed */ + if (s) + queue_if_no_path = 0; + else s = dm_simplecmd_flush(DM_DEVICE_SUSPEND, mapname, 0); if (!dm_flush_map(mapname)) { @@ -703,6 +714,8 @@ dm_suspend_and_flush_map (const char * mapname) } condlog(2, "failed to remove multipath map %s", mapname); dm_simplecmd_noflush(DM_DEVICE_RESUME, mapname); + if (queue_if_no_path) + s = dm_queue_if_no_path((char *)mapname, 1); return 1; }