Don't forget to reload table when both reload and rename is required
PATCH 1/1 Don't forget to reload table when both reload and rename is required
We encounter the following case:
@ After adding a multipaths section into /etc/multipath.conf to specify 'alias' @ and other attributes for a particular multipath device and
@ reloading/restarting the multipathd service, only renaming of the multipath @ device is done, other attribute changes are ignored.
@
@ It is more evident if you directly run 'multipath -r' to reload devmap after @ adding the 'multipaths' section with alias into /etc/multipath.conf. @
@ When reload/restart multipathd service or 'multipath -r' again, new settings @ can be applied right.
It's because that in select_action() when force_reload is set, if we also need rename the mpp device, reload action won't be taken any more.
I did this patch by introducing a new action ACT_RENAME2 to group these two action. Test passed. However, it seems to be a rough patch and I am not certain if this bind is fine refering to dm_reassign. Please comment, Thanks.
--- libmultipath/configure.c | 11 +++++++++++ libmultipath/configure.h | 1 + 2 files changed, 12 insertions(+)
libmultipath/configure.c +11 -0
@@ -385,6 +385,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload) cmpp->alias, mpp->alias);strncpy (mpp->alias_old, cmpp->alias,WWID_SIZE ); mpp->action =ACT_RENAME ; +if (force_reload) + mpp->action =ACT_RENAME2 ;return ; } mpp->action =ACT_CREATE ;
@@ -623,6 +625,15 @@ domap (struct multipath * mpp, char * params) r =dm_rename (mpp->alias_old, mpp->alias);break ; +case ACT_RENAME2 : + r =dm_rename (mpp->alias_old, mpp->alias); +if (r) { + r =dm_addmap_reload (mpp, params); +if (r) + r =dm_simplecmd_noflush (DM_DEVICE_RESUME , mpp->alias,MPATH_UDEV_RELOAD_FLAG ); + } +break ; +default :break ; }
libmultipath/configure.h +1 -0
@@ -18,6 +18,7 @@ enum actions {ACT_RENAME ,ACT_CREATE ,ACT_RESIZE , + ACT_RENAME2, };#define FLUSH_ONE 1
Signature · 1 line
1.9.0
Christophe Varoqui
AppliedApplied.
Thanks.
Quoted 79 lines · Vaughan Cao
We encounter the following case:
@ After adding a multipaths section into
/etc/multipath.confto specify 'alias'
@ and other attributes for a particular multipath device and @ reloading/restarting the multipathd service, only renaming of the multipath
@ device is done, other attribute changes are ignored.
@
@ It is more evident if you directly run 'multipath -r' to reload devmap after
@ adding the 'multipaths' section with alias into/etc/multipath.conf. @
@ When reload/restart multipathd service or 'multipath -r' again, new settings
@ can be applied right.It's because that in
select_action()whenforce_reloadis set, if we also need
rename the mpp device, reload action won't be taken any more.I did this patch by introducing a new action
ACT_RENAME2to group these two action. Test passed. However, it seems to be a rough patch and I am not certain if this bind is fine refering todm_reassign. Please comment, Thanks.Signed-off-by Vaughan Cao <[email protected]>--- libmultipath/configure.c | 11 +++++++++++ libmultipath/configure.h | 1 + 2 files changed, 12 insertions(+)libmultipath/configure.c +2
-0@@ -385,6 +385,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload) cmpp->alias, mpp->alias);strncpy (mpp->alias_old, cmpp->alias,WWID_SIZE ); mpp->action =ACT_RENAME ; +if (force_reload) + mpp->action =ACT_RENAME2 ;return ; }mpp->action = ACT_CREATE;libmultipath/configure.c +9
-0@@ -623,6 +625,15 @@ domap (struct multipath * mpp, char * params) r =dm_rename (mpp->alias_old, mpp->alias);break ; +case ACT_RENAME2 : + r =dm_rename (mpp->alias_old, mpp->alias); +if (r) { + r =dm_addmap_reload (mpp, params); +if (r) + r =dm_simplecmd_noflush (DM_DEVICE_RESUME , mpp->alias,MPATH_UDEV_RELOAD_FLAG ); + } +break ; +default :break ;}libmultipath/configure.h +1
-1@@ -18,6 +18,7 @@ enum actions {ACT_RENAME ,ACT_CREATE ,ACT_RESIZE , + ACT_RENAME2, };#define FLUSH_ONE 1 --1.9.0