Re: [PATCH 12/14] libmultipath: uevent_filter(): filter previously merged events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 On Thu, Mar 31, 2022 at 12:15:08AM +0200, mwilck@xxxxxxxx wrote:
> With the new list-appending logic, it can happen that previously
> merged events can now be filtered. Do it.
> 
> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
> ---
>  libmultipath/uevent.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
> index eb900ec..809c74c 100644
> --- a/libmultipath/uevent.c
> +++ b/libmultipath/uevent.c
> @@ -305,7 +305,7 @@ static void uevent_delete_from_list(struct uevent *to_delete,
>  	 * for the anchor), "old_tail" must be moved. It can happen that
>  	 * "old_tail" ends up pointing at the anchor.
>  	 */
> -	if (*old_tail == &to_delete->node)
> +	if (old_tail && *old_tail == &to_delete->node)
>  		*old_tail = to_delete->node.prev;
>  
>  	list_del_init(&to_delete->node);
> @@ -360,6 +360,20 @@ uevent_filter(struct uevent *later, struct uevent_filter_state *st)
>  		 * filter unnessary earlier uevents
>  		 * by the later uevent
>  		 */
> +		if (!list_empty(&earlier->merge_node)) {
> +			struct uevent *mn, *t;
> +
> +			list_for_each_entry_reverse_safe(mn, t, &earlier->merge_node, node) {
> +				if (uevent_can_filter(mn, later)) {
> +					condlog(4, "uevent: \"%s %s\" (merged into \"%s %s\") filtered by \"%s %s\"",
> +						mn->action, mn->kernel,
> +						earlier->action, earlier->kernel,
> +						later->action, later->kernel);
> +					uevent_delete_from_list(mn, &t, NULL);

Just like with 05/14, you could just use a much simpler delete function
here, since moving old_tail and merged nodes is unnecessary. I guess I
don't care that much, if you'd rather just have one function, so

Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>

> +					st->filtered++;
> +				}
> +			}
> +		}
>  		if (uevent_can_filter(earlier, later)) {
>  			condlog(3, "uevent: %s-%s has filtered by uevent: %s-%s",
>  				earlier->kernel, earlier->action,
> -- 
> 2.35.1
--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux