Miscellaneous multipath bugfixes
Benjamin Marzinski
maintainerPATCH 1/1 Miscellaneous multipath bugfixes
This is mostly a cleanup of some bugs that recently got introduced. In ACT_RESIZE we were trying to create a read-only device before we tried to create a read/write one (I also added the ability to fail back to read-only in ACT_RELOAD). There were some printouts that I assume were for debugging, and some duplicate code. And I switched it so that dm_simplecmd_flush did flushing, and dm_simplecmd_noflush didn't.
--- libmultipath/configure.c | 13 ++++++++----- libmultipath/devmapper.c | 11 ++++------- multipathd/cli_handlers.c | 9 ++------- 3 files changed, 14 insertions(+), 19 deletions(-)
libmultipath/configure.c +8 -5
@@ -352,16 +352,19 @@ domap (struct multipath * mpp)break ;case ACT_RELOAD : - r = (dm_addmap_reload (mpp->alias, mpp->params, mpp->size,NULL ) - &&dm_simplecmd_flush (DM_DEVICE_RESUME , mpp->alias)); + r =dm_addmap_reload (mpp->alias, mpp->params, mpp->size,NULL ); +if (!r) + r =dm_addmap_reload_ro (mpp->alias, mpp->params, mpp->size,NULL ); +if (r) + r =dm_simplecmd_noflush (DM_DEVICE_RESUME , mpp->alias);break ;case ACT_RESIZE : - r =dm_addmap_reload_ro (mpp->alias, mpp->params, mpp->size,NULL ); + r =dm_addmap_reload (mpp->alias, mpp->params, mpp->size,NULL );if (!r) - r =dm_addmap_reload (mpp->alias, mpp->params, mpp->size,NULL ); + r =dm_addmap_reload_ro (mpp->alias, mpp->params, mpp->size,NULL );if (r) - r =dm_simplecmd_noflush (DM_DEVICE_RESUME , mpp->alias); + r =dm_simplecmd_flush (DM_DEVICE_RESUME , mpp->alias);break ;case ACT_RENAME :
libmultipath/devmapper.c +4 -7
@@ -176,12 +176,12 @@ dm_simplecmd (int task, const char *nameextern int dm_simplecmd_flush (int task,const char *name) { -return dm_simplecmd (task, name,1 ); +return dm_simplecmd (task, name,0 ); }extern int dm_simplecmd_noflush (int task,const char *name) { -return dm_simplecmd (task, name,0 ); +return dm_simplecmd (task, name,1 ); } extern int
@@ -204,9 +204,6 @@ dm_addmap (int task, const char *name, cif (ro)dm_task_set_ro (dmt); -if (ro) -dm_task_set_ro (dmt); -if (uuid){ prefixed_uuid =MALLOC (UUID_PREFIX_LEN +strlen (uuid) +1 );if (!prefixed_uuid) {
@@ -550,7 +547,7 @@ dm_flush_map (const char * mapname)return 1 ; } - r =dm_simplecmd_noflush (DM_DEVICE_REMOVE , mapname); + r =dm_simplecmd_flush (DM_DEVICE_REMOVE , mapname);if (r) {condlog (4 ,"multipath map %s removed" , mapname);
@@ -949,7 +946,7 @@ dm_remove_partmaps (const char * mapname*/ condlog (4 ,"partition map %s removed" , names->name); -dm_simplecmd_noflush (DM_DEVICE_REMOVE , names->name); +dm_simplecmd_flush (DM_DEVICE_REMOVE , names->name); } next = names->next;
multipathd/cli_handlers.c +2 -7
@@ -459,7 +459,6 @@ cli_resize(void *v, char **reply, int *l pgp =VECTOR_SLOT (mpp->pg,0 ); pp =VECTOR_SLOT (pgp->paths,0 ); -condlog (0 ,"%s: reading sysfs." , mapname);if (sysfs_get_size (pp->sysdev, &size)) {condlog (0 ,"%s: couldn't get size for sysfs. cannot resize" , mapname);
@@ -473,15 +472,11 @@ cli_resize(void *v, char **reply, int *lcondlog (3 ,"%s old size is %llu, new size is %llu" , mapname, mpp->size, size); -condlog (0 ,"%s: resize_map." , mapname);if (resize_map (mpp, size, vecs) !=0 )return 1 ; -condlog (0 ,"%s: dm_lib_release." , mapname);dm_lib_release (); -condlog (0 ,"%s: setup multipath." , mapname);setup_multipath (vecs, mpp); -condlog (0 ,"%s: sync map state." , mapname);sync_map_state (mpp);return 0 ;
@@ -513,7 +508,7 @@ cli_suspend(void * v, char ** reply, int {struct vectors * vecs = (struct vectors *)data;char * param =get_keyparam (v,MAP ); -int r =dm_simplecmd_flush (DM_DEVICE_SUSPEND , param); +int r =dm_simplecmd_noflush (DM_DEVICE_SUSPEND , param);condlog (2 ,"%s: suspend (operator)" , param);
@@ -534,7 +529,7 @@ cli_resume(void * v, char ** reply, int {struct vectors * vecs = (struct vectors *)data;char * param =get_keyparam (v,MAP ); -int r =dm_simplecmd_flush (DM_DEVICE_RESUME , param); +int r =dm_simplecmd_noflush (DM_DEVICE_RESUME , param);condlog (2 ,"%s: resume (operator)" , param);
Quoted 8 lines · Benjamin Marzinski
This is mostly a cleanup of some bugs that recently got introduced. In
ACT_RESIZEwe were trying to create a read-only device before we tried to create a read/write one (I also added the ability to fail back to read-only inACT_RELOAD). There were some printouts that I assume were for debugging, and some duplicate code. And I switched it so thatdm_simplecmd_flushdid flushing, anddm_simplecmd_noflushdidn't.Signed-off-by Benjamin Marzinski <[email protected]>