Add "reconfigure all" multipath command
Benjamin Marzinski
maintainerv2 cover Add "reconfigure all" multipath command
This patchset is supposed to replace Martin's
multipathd: add "force_reconfigure" option
patch from his uxlsnr overhaul patchset. It also makes the default reconfigure be a weak reconfigure, but instead of adding a configuration option to control this, it adds a new multipathd command, "reconfigure all", to do a full reconfigure. The HUP signal is left doing only weak reconfigures.
In order to keep from having two states that are handled nearly identically, the code adds an extra variable to track the type of configuration that was selected, but this could easily be switch to use a new DAEMON_CONFIGURE_ALL state instead.
The final patch, that added the new command, is meant to apply on top of Martin's changed client handler code. I can send one that works with the current client handler code, if people would rather review that.
Changes from v1 as suggested by Martin Wilck:
0001: update libmultipath.version to handle ABI change in struct config 0003: Clarify commit message
Benjamin Marzinski (4):
multipathd: move delayed_reconfig out of struct config
multipathd: remove reconfigure from header file.
multipathd: pass in the type of reconfigure
multipathd: add "reconfigure all" command.
libmpathpersist/libmpathpersist.version | 12 ++-- libmultipath/config.h | 1 - libmultipath/configure.c | 2 +- libmultipath/libmultipath.version | 22 +++--- multipath/main.c | 2 +- multipathd/cli.c | 1 + multipathd/cli.h | 2 + multipathd/cli_handlers.c | 12 +++- multipathd/main.c | 91 ++++++++++++++----------- multipathd/main.h | 3 +- multipathd/multipathd.8 | 10 ++- 11 files changed, 91 insertions(+), 67 deletions(-)
Signature · 6 lines
2.17.2 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH v2 1/4 multipathd: move delayed_reconfig out of struct config
delayed_reconfig was inside the config struct, but it wasn't updated during an RCU write section, so there's no synchronization on it. Instead, pull it out of the config structure, and use the config_lock to synchronize it.
--- libmpathpersist/libmpathpersist.version | 12 +++---- libmultipath/config.h | 1 - libmultipath/libmultipath.version | 22 +++++------- multipathd/main.c | 45 ++++++++++++++++--------- 4 files changed, 42 insertions(+), 38 deletions(-)
libmpathpersist/libmpathpersist.version +5 -7
@@ -10,7 +10,7 @@ * * See libmultipath.version for general policy about version numbers. */ -LIBMPATHPERSIST_1.0.0 { +LIBMPATHPERSIST_2.0.0 { global: __mpath_persistent_reserve_in;
@@ -28,11 +28,9 @@ global: prout_do_scsi_ioctl; update_map_pr; -local: *; -}; - -LIBMPATHPERSIST_1.1.0 { -global: + /* added int 1.1.0 */ libmpathpersist_init; libmpathpersist_exit; -} LIBMPATHPERSIST_1.0.0; + +local: *; +};
libmultipath/config.h +0 -1
@@ -178,7 +178,6 @@ struct config {int strict_timing;int retrigger_tries;int retrigger_delay; -int delayed_reconfig;int uev_wait_timeout;int skip_kpartx;int remove_retries;
libmultipath/libmultipath.version +8 -14
@@ -31,7 +31,7 @@ * The new version inherits the previous ones. */ -LIBMULTIPATH_9.0.0 { +LIBMULTIPATH_10.0.0 { global: /* symbols referenced by multipath and multipathd */ add_foreign;
@@ -284,21 +284,15 @@ global: /* added in 8.2.0 */ check_daemon; -local: - *; -}; - -LIBMULTIPATH_9.1.0 { -global: + /* added in 9.1.0 */ timespeccmp; -} LIBMULTIPATH_9.0.0; -LIBMULTIPATH_9.2.0 { -global: + /* added in 9.2.0 */ set_wakeup_fn; -} LIBMULTIPATH_9.1.0; -LIBMULTIPATH_9.3.0 { -global: + /* added in 9.3.0 */ __snprint_config; -} LIBMULTIPATH_9.2.0; + +local: + *; +};
multipathd/main.c +29 -16
99 lines not on this page · raw message
Signature · 6 lines
2.17.2 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH v2 2/4 multipathd: remove reconfigure from header file.
In reply to Benjamin MarzinskiOnly multipathd/main.c uses it.
--- multipathd/main.h | 1 - 1 file changed, 1 deletion(-)
multipathd/main.h +0 -1
@@ -39,7 +39,6 @@ enum daemon_status wait_for_state_change_if(enum daemon_status oldstate, unsigned long ms);void schedule_reconfigure (void );int need_to_delay_reconfig (struct vectors *); -int reconfigure (struct vectors *);int ev_add_path (struct path *,struct vectors *,int );int ev_remove_path (struct path *,struct vectors *,int );int ev_add_map (char *,const char *,struct vectors *);
Signature · 6 lines
2.17.2 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH v2 3/4 multipathd: pass in the type of reconfigure
In reply to Benjamin Marzinskischedule_reconfigure() now takes the type of reconfigure to do, and that gets passed down to reconfigure(). If a full reconfigure has already been requested but not started, weak reconfigure requests will be upgraded. Currently cli_reconfigure() and the HUP signal request full reconfigures, while the initial reconfigure, ev_add_map(), and missing_uev_wait_tick() request weak reconfigures. A future patch will enable users to control what kind of reconfigures happen.
--- libmultipath/configure.c | 2 +- multipathd/cli_handlers.c | 2 +- multipathd/main.c | 62 ++++++++++++++++++++------------------- multipathd/main.h | 2 +- 4 files changed, 35 insertions(+), 33 deletions(-)
libmultipath/configure.c +1 -1
@@ -1098,7 +1098,7 @@ out:* FORCE_RELOAD_NONE: existing maps aren't touched at all * FORCE_RELOAD_YES: all maps are rebuilt from scratch and (re)loaded in DM * FORCE_RELOAD_WEAK: existing maps are compared to the current conf and only -* reloaded in DM if there's a difference. This is useful during startup. +* reloaded in DM if there's a difference. This is normally sufficient. */ int coalesce_paths (struct vectors *vecs,vector mpvec,char *refwwid,int force_reload,enum mpath_cmds cmd)
multipathd/cli_handlers.c +1 -1
@@ -1012,7 +1012,7 @@ cli_reconfigure(void * v, struct strbuf *reply, void * data) {condlog (2 ,"reconfigure (operator)" ); -schedule_reconfigure (); +schedule_reconfigure (true);return 0 ; }
multipathd/main.c +32 -30
159 lines not on this page · raw message
multipathd/main.h +1 -1
@@ -37,7 +37,7 @@ void exit_daemon(void);const char *daemon_status (void );enum daemon_status wait_for_state_change_if (enum daemon_status oldstate,unsigned long ms); -void schedule_reconfigure (void ); +void schedule_reconfigure (bool reconfig_all);int need_to_delay_reconfig (struct vectors *);int ev_add_path (struct path *,struct vectors *,int );int ev_remove_path (struct path *,struct vectors *,int );
Signature · 6 lines
2.17.2 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerPATCH v2 4/4 multipathd: add "reconfigure all" command.
In reply to Benjamin MarzinskiWith this commit, multipathd no longer defaults to full reconfigures for the "reconfigure" command and the HUP signal. The default is a weak reconfigure. A new command, "reconfigure all", has been added to do a full reconfigure.
--- multipath/main.c | 2 +- multipathd/cli.c | 1 + multipathd/cli.h | 2 ++ multipathd/cli_handlers.c | 10 ++++++++++ multipathd/main.c | 2 +- multipathd/multipathd.8 | 10 ++++++++-- 6 files changed, 23 insertions(+), 4 deletions(-)
multipath/main.c +1 -1
@@ -759,7 +759,7 @@ int delegate_to_multipathd(enum mpath_cmds cmd,return NOT_DELEGATED ;if (cmd ==CMD_CREATE && conf->force_reload ==FORCE_RELOAD_YES ) { - p +=snprintf (p, n,"reconfigure" ); + p +=snprintf (p, n,"reconfigure all" ); }else if (cmd ==CMD_FLUSH_ONE && dev && dev_type ==DEV_DEVMAP ) { p +=snprintf (p, n,"del map %s" , dev);
multipathd/cli.c +1 -0
@@ -212,6 +212,7 @@ load_keys (void) r +=add_key (keys,"local" ,LOCAL ,0 ); r +=add_key (keys,"setmarginal" ,SETMARGINAL ,0 ); r +=add_key (keys,"unsetmarginal" ,UNSETMARGINAL ,0 ); + r +=add_key (keys,"all" ,ALL ,0 );if (r) {
multipathd/cli.h +2 -0
@@ -47,6 +47,7 @@ enum { __LOCAL,/* 40 */ __SETMARGINAL, __UNSETMARGINAL, + __ALL, };#define LIST (1ULL << __LIST)
@@ -93,6 +94,7 @@ enum {#define LOCAL (1ULL << __LOCAL)#define SETMARGINAL (1ULL << __SETMARGINAL)#define UNSETMARGINAL (1ULL << __UNSETMARGINAL) +#define ALL (1ULL << __ALL)#define INITIAL_REPLY_LEN 1200
multipathd/cli_handlers.c +10 -0
@@ -1012,6 +1012,15 @@ cli_reconfigure(void * v, struct strbuf *reply, void * data) {condlog (2 ,"reconfigure (operator)" ); +schedule_reconfigure (false); +return 0 ; +} + +int +cli_reconfigure_all (void * v,struct strbuf *reply,void * data) +{ +condlog (2 ,"reconfigure all (operator)" ); +schedule_reconfigure (true);return 0 ; }
@@ -1497,6 +1506,7 @@ void init_handler_callbacks(void)set_handler_callback (DEL +MAPS , cli_del_maps);set_handler_callback (SWITCH +MAP +GROUP , cli_switch_group);set_unlocked_handler_callback (RECONFIGURE , cli_reconfigure); +set_unlocked_handler_callback (RECONFIGURE +ALL , cli_reconfigure_all);set_handler_callback (SUSPEND +MAP , cli_suspend);set_handler_callback (RESUME +MAP , cli_resume);set_handler_callback (RESIZE +MAP , cli_resize);
multipathd/main.c +1 -1
@@ -2817,7 +2817,7 @@ handle_signals(bool nonfatal)return ;if (reconfig_sig) {condlog (2 ,"reconfigure (signal)" ); -schedule_reconfigure (true); +schedule_reconfigure (false); }if (log_reset_sig) {condlog (2 ,"reset log (signal)" );
multipathd/multipathd.8 +8 -2
@@ -195,10 +195,16 @@ group index, starting with 1. . .TP .B reconfigure -Reconfigures the multipaths. This should be triggered automatically after anyi -hotplug event. +Rereads the configuration, and reloads all changed multipath devices. This +also happens at startup, when the service is reload, or when a SIGHUP is +received. . .TP +.B reconfigure all +Rereads the configuration, and reloads all multipath devices regardless of +whether or not they have changed. This also happens when \fImultipath -r\fR is +run. +.TP .B suspend map|multipath $map Sets map $map into suspend state. .
Signature · 6 lines
2.17.2 -- dm-devel mailing list [email protected] https://listman.redhat.com/mailman/listinfo/dm-devel
Quoted 6 lines · Benjamin Marzinski
Changes from v1 as suggested by Martin Wilck:
0001: update libmultipath.version to handle ABI change in struct config
0003: Clarify commit message
Did you overlook the two other comments I had on 0003, or did you deliberately ignore them? Just asking.
Martin
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerQuoted 10 lines · Martin Wilck
Quoted 6 lines · Benjamin Marzinski
Changes from v1 as suggested by Martin Wilck:
0001: update libmultipath.version to handle ABI change in struct config
0003: Clarify commit messageDid you overlook the two other comments I had on 0003, or did you deliberately ignore them? Just asking.
Ooops. Missed them. I'll resend.
-Ben
Quoted 2 lines
Martin
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerQuoted 10 lines · Martin Wilck
Quoted 6 lines · Benjamin Marzinski
Changes from v1 as suggested by Martin Wilck:
0001: update libmultipath.version to handle ABI change in struct config
0003: Clarify commit messageDid you overlook the two other comments I had on 0003, or did you deliberately ignore them? Just asking.
Now that I look at this, I'd rather not change the reconfigure() and configure() argument names to reload_type. That's the name of the global variable which has serialization concerns, and reusing it as an argument seems like it would lead to more confusion.
Actually, since reload_type can only be changed when switching to the DAEMON_CONFIGURE state, and you can't switch to that state again until after do the reconfigure, it's safe to simply have configure() access the global variable, reload_type.
-Ben
Quoted 2 lines
Martin
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Quoted 12 lines · Benjamin Marzinski
Quoted 10 lines · Martin Wilck
Quoted 6 lines · Benjamin Marzinski
Changes from v1 as suggested by Martin Wilck:
0001: update libmultipath.version to handle ABI change in struct config
0003: Clarify commit messageDid you overlook the two other comments I had on 0003, or did you deliberately ignore them? Just asking.
Quoted 6 lines
Now that I look at this, I'd rather not change the
reconfigure()andconfigure()argument names toreload_type. That's the name of the global
variable which has serialization concerns, and reusing it as an argument
seems like it would lead to more confusion.
Right. My point was that "type" is too generic. I didn't think about the name clash.
Quoted 5 lines
Actually, since
reload_typecan only be changed when switching to theDAEMON_CONFIGUREstate, and you can't switch to that state again until
after do the reconfigure, it's safe to simply haveconfigure()access the global variable,reload_type.
I'm not a big fan of new global variables, but this should be fine.
Regards
Martin
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel