Rework uevent filtering and merging
v2 cover Rework uevent filtering and merging
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 1/15 multipathd: allow adding git rev as version suffix
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 2/15 multipathd: don't switch to DAEMON_IDLE during startup
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 3/15 uevent_dispatch(): use while in wait loop
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 4/15 libmultipath: uevent_dispatch(): process uevents one by one
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 5/15 multipathd: reconfigure: disallow changing uid_attrs
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] [PATCH v2 05/15] multipathd: reconfigure: disallow changing uid_attrs
Quoted 5 lines · On Mon, Apr 04, 2022 at 07:04:47PM +0200, [email protected] wrote:
uevent merging by WWID relies on the
uid_attrsconfig option. As we drop struct config between calls touevent_merge(), we must be sure that the WWID is not changed inreconfigure().Signed-off-by Martin Wilck <[email protected]>
Quoted 101 lines
--- multipath/multipath.conf.5 | 2 ++ multipathd/main.c | 59 ++++++++++++++++++++++++++++++++------ 2 files changed, 52 insertions(+), 9 deletions(-)multipath/multipath.conf.5 +2
-0@@ -264,6 +264,8 @@ If this option is configured and matches the device node name of a device, it overrides any other configured methods for determining the WWID for this device. .PP +This option cannot be changed during runtime with the multipathd \fBreconfigure\fR command. +.PP The default is: \fB<unset>\fR. To enable uevent merging, set it e.g. to \(dqsd:ID_SERIAL dasd:ID_UID nvme:ID_WWN\(dq. .REmultipathd/main.c +50
-9@@ -2835,11 +2835,58 @@ void rcu_free_config(struct rcu_head *head)free_config (conf); } +static bool reconfigure_check_uid_attrs (const struct _vector *old_attrs, +const struct _vector *new_attrs) +{ +int i; +char *old; + +if (VECTOR_SIZE (old_attrs) !=VECTOR_SIZE (new_attrs)) +return true; + + vector_foreach_slot(old_attrs, old, i) { +char *new =VECTOR_SLOT (new_attrs, i); + +if (strcmp (old, new)) +return true; + } + +return false; +} + +static void reconfigure_check (struct config *old,struct config *new) +{ +int old_marginal_pathgroups; + + old_marginal_pathgroups = old->marginal_pathgroups; +if ((old_marginal_pathgroups ==MARGINAL_PATHGROUP_FPIN ) != + (new->marginal_pathgroups ==MARGINAL_PATHGROUP_FPIN )) { +condlog (1 ,"multipathd must be restarted to turn %s fpin marginal paths" , + (old_marginal_pathgroups ==MARGINAL_PATHGROUP_FPIN )? +"off" :"on" ); + new->marginal_pathgroups = old_marginal_pathgroups; + } + +if (reconfigure_check_uid_attrs (&old->uid_attrs, &new->uid_attrs)) { +int i; +void *ptr; + +condlog (1 ,"multipathd must be restarted to change uid_attrs, keeping old values" ); + vector_foreach_slot(&new->uid_attrs, ptr, i) +free (ptr); +vector_reset (&new->uid_attrs); + new->uid_attrs = old->uid_attrs; + +/* avoid uid_attrs being freed in rcu_free_config() */ + old->uid_attrs.allocated =0 ; + old->uid_attrs.slot =NULL ; + } +} +static int reconfigure (struct vectors *vecs,enum force_reload_types reload_type) {struct config * old, *conf; -int old_marginal_pathgroups; conf =load_config (DEFAULT_CONFIGFILE );if (!conf)@@ -2870,14 +2917,8 @@ reconfigure (struct vectors *vecs, enum force_reload_types reload_type) uxsock_timeout = conf->uxsock_timeout; old =rcu_dereference (multipath_conf); - old_marginal_pathgroups = old->marginal_pathgroups; -if ((old_marginal_pathgroups ==MARGINAL_PATHGROUP_FPIN ) != - (conf->marginal_pathgroups ==MARGINAL_PATHGROUP_FPIN )) { -condlog (1 ,"multipathd must be restarted to turn %s fpin marginal paths" , - (old_marginal_pathgroups ==MARGINAL_PATHGROUP_FPIN )? -"off" :"on" ); - conf->marginal_pathgroups = old_marginal_pathgroups; - } +reconfigure_check (old, conf); + conf->sequence_nr = old->sequence_nr +1 ;rcu_assign_pointer (multipath_conf, conf);call_rcu (&old->rcu, rcu_free_config);Signature · 1 line
2.35.1
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 6/15 libmultipath: microoptimize uevent filtering and merging
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 7/15 libmultipath: uevent_listen(): don't delay uevents
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 8/15 libmultipath: uevent: use struct to pass parameters around
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 9/15 libmultipath: uevent: log statistics about filtering and merging
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 10/15 libmultipath: merge_uevq(): filter first, then merge
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 11/15 libmultipath: uevent_filter(): filter previously merged events
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 12/15 libmultipath: uevent: improve log messages
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 13/15 libmultipath: uevent: add debug messages for event queue
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 14/15 libmultipath: apply_format(): prevent buffer overflow
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] [PATCH v2 14/15] libmultipath: apply_format(): prevent buffer overflow
Quoted 1 line · On Mon, Apr 04, 2022 at 07:04:56PM +0200, [email protected] wrote:
Potential overflow found by coverity (CID 376918).
Quoted 19 lines
--- libmultipath/callout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libmultipath/callout.c +1
-1@@ -160,7 +160,7 @@ int apply_format(char * string, char * cmd, struct path * pp) myfree =CALLOUT_MAX_SIZE ;if (!pos) { -strcpy (dst, string); +strlcpy (dst, string,CALLOUT_MAX_SIZE );return 0 ; }Signature · 1 line
2.35.1
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
PATCH v2 15/15 libmultipath: avoid memory leak with uid_attrs
In reply to [email protected]--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Re: [dm-devel] [PATCH v2 15/15] libmultipath: avoid memory leak with uid_attrs
Quoted 3 lines · On Mon, Apr 04, 2022 at 07:04:57PM +0200, [email protected] wrote:
Free all vector elements when freeing
uid_attrs.Signed-off-by Martin Wilck <[email protected]>
Quoted 48 lines
--- libmultipath/config.c | 5 +++++ libmultipath/dict.c | 5 +++++ 2 files changed, 10 insertions(+)libmultipath/config.c +5
-0@@ -656,6 +656,9 @@ static struct config *alloc_config (void)static void _uninit_config (struct config *conf) { +void *ptr; +int i; +if (!conf) conf = &__internal_config;@@ -668,6 +671,8 @@ static void _uninit_config(struct config *conf)if (conf->uid_attribute)free (conf->uid_attribute); + vector_foreach_slot(&conf->uid_attrs, ptr, i) +free (ptr);vector_reset (&conf->uid_attrs);if (conf->getuid)libmultipath/dict.c +5
-0@@ -597,8 +597,13 @@ static int uid_attrs_handler(struct config *conf, vector strvec, const char *file, int line_nr) { char *val; +void *ptr; +int i; + vector_foreach_slot(&conf->uid_attrs, ptr, i) +free (ptr);vector_reset (&conf->uid_attrs); + val =set_value (strvec);if (!val)return 1 ;Signature · 1 line
2.35.1
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel
Benjamin Marzinski
maintainerOn Mon, Apr 04, 2022 at 07:04:42PM +0200, [email protected] wrote:
FYI, these are still not coming through as plain-text messages. See
https://listman.redhat.com/archives/dm-devel/2022-April/050155.html
-Ben
--
dm-devel mailing list
[email protected]
https://listman.redhat.com/mailman/listinfo/dm-devel