libmultipath: assign variable to make gcc happy
Benjamin Marzinski
maintainerPATCH v2 1/3 libmultipath: assign variable to make gcc happy
There is nothing wrong with is_queueing not being set at the start of __set_no_path_retry(), it will always get set before it is accessed, but gcc 8.2.1 is failing with
structs_vec.c: In function ‘__set_no_path_retry’:
structs_vec.c:339:7: error: ‘is_queueing’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
bool is_queueing;
^~~~~~~~~~~so, assign a value to make it happy.
--- libmultipath/structs_vec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libmultipath/structs_vec.c +1 -1
@@ -336,7 +336,7 @@ static void leave_recovery_mode(struct multipath *mpp)void __set_no_path_retry (struct multipath *mpp,bool check_features) { -bool is_queueing; +bool is_queueing = false;/* assign a value to make gcc happy */ check_features = check_features && mpp->features !=NULL ;if (check_features)
Signature · 6 lines
2.17.2 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH v2 2/3 libmutipath: don't close fd on dm_lib_release
If dm_hold_control_open() isn't set, when dm_lib_release() is called, it will close the control fd. The control fd will get re-opened on the next dm_task_run() call, but if there is a dm_task_run() call already in progress in another thread, it can fail. Since many of the device-mapper callouts happen with the vecs lock held, this wasn't too noticeable, but there is code that calls dm_task_run() without the vecs lock held, notably the dmevent waiter code.
Since, as Martin pointed out, dm_hold_control_open() hasn't always existed in libdevmapper, check if it's supported on compilation, and update the version requirements if so.
--- libmultipath/Makefile | 4 ++++ libmultipath/devmapper.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-)
libmultipath/Makefile +4 -0
@@ -36,6 +36,10 @@ ifneq ($(call check_func,dm_task_deferred_remove,/usr/include/libdevmapper.h),0) CFLAGS += -DLIBDM_API_DEFERRED endif +ifneq ($(call check_func,dm_hold_control_dev,/usr/include/libdevmapper.h),0) + CFLAGS += -DLIBDM_API_HOLD_CONTROL +endif + OBJS = memory.o parser.o vector.o devmapper.o callout.o \ hwtable.o blacklist.o util.o dmparser.o config.o \ structs.o discovery.o propsel.o dict.o \
libmultipath/devmapper.c +6 -1
@@ -108,7 +108,9 @@ dm_lib_prereq (void) {char version[64 ];int v[3 ]; -#if defined(LIBDM_API_DEFERRED ) +#if defined(LIBDM_API_HOLD_CONTROL ) +int minv[3 ] = {1 ,2 ,111 }; +#elif defined(LIBDM_API_DEFERRED )int minv[3 ] = {1 ,2 ,89 };#elif defined(DM_SUBSYSTEM_UDEV_FLAG0 )int minv[3 ] = {1 ,2 ,82 };
@@ -254,6 +256,9 @@ void libmp_dm_init(void)memcpy (conf->version, version,sizeof (version));put_multipath_config (conf);dm_init (verbosity); +#ifdef LIBDM_API_HOLD_CONTROL +dm_hold_control_dev (1 ); +#endif dm_udev_set_sync_support (libmp_dm_udev_sync); }
Signature · 1 line
2.17.2
Re: [PATCH v2 2/3] libmutipath: don't close fd on dm_lib_release
Quoted 11 lines · Benjamin Marzinski
If
dm_hold_control_open()isn't set, whendm_lib_release()is called, it
will close the control fd. The control fd will get re-opened on the nextdm_task_run()call, but if there is adm_task_run()call already in progress in another thread, it can fail. Since many of the device-mapper callouts happen with the vecs lock held, this wasn't too
noticeable, but there is code that callsdm_task_run()without the vecs lock held, notably the dmevent waiter code.
Quoted 5 lines
Since, as Martin pointed out,
dm_hold_control_open()hasn't always existed in libdevmapper, check if it's supported on compilation, and update the version requirements if so.Signed-off-by Benjamin Marzinski <[email protected]>
Signature · 4 lines
Dr. Martin Wilck <[email protected]>, Tel. +49 (0)911 74053 2107 SUSE Software Solutions Germany GmbH HRB 36809, AG Nürnberg GF: Felix Imendörffer
Benjamin Marzinski
maintainerPATCH v2 3/3 libmultipath: allow force reload with no active paths
In reply to Benjamin MarzinskiIf the partition information has changed on multipath devices (say, because it was updated on another node that has access to the same storage), users expect that running "multipathd reconfigure" will update that. However, if the checkers for the multipath device are pending for too long when the the device is reconfigured, multipathd will give up waiting for them, and refuse to reload the device, since there are no active paths. This means that no kpartx update will be triggered.
Multipath is fully capable of reloading a multipath device that has no active paths. This has been possible for years. If multipath is supposed to reload the device, it should do so, even if there are no active paths.
Generally, when multipath is force reloaded, kpartx will be updated. However when a device is reloaded with no paths, the udev rules won't run kpartx. But they also weren't running kpartx when the first valid path appeared, even though the dm activation rules get run in this case. This changes 11-dm-mpath.rules to run kpartx when a device goes from no usable paths to having usable paths.
--- libmultipath/configure.c | 6 ------ multipath/11-dm-mpath.rules | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-)
libmultipath/configure.c +0 -6
@@ -710,12 +710,6 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)return ; } -if (pathcount (mpp,PATH_UP ) ==0 ) { - mpp->action =ACT_IMPOSSIBLE ; -condlog (3 ,"%s: set ACT_IMPOSSIBLE (no usable path)" , - mpp->alias); -return ; - }if (force_reload) { mpp->force_udev_reload =1 ; mpp->action =ACT_RELOAD ;
multipath/11-dm-mpath.rules +1 -1
@@ -75,7 +75,7 @@ ENV{MPATH_DEVICE_READY}=="0", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="1" ENV{MPATH_DEVICE_READY}!="0", ENV{.MPATH_DEVICE_READY_OLD}=="0",\ ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}="$env{DM_DISABLE_OTHER_RULES_FLAG_OLD}",\ ENV{DM_DISABLE_OTHER_RULES_FLAG_OLD}="",\ - ENV{DM_ACTIVATION}="1" + ENV{DM_ACTIVATION}="1", ENV{MPATH_UNCHANGED}="0" # The code to check multipath state ends here. We need to set # properties and symlinks regardless whether the map is usable or
Signature · 1 line
2.17.2