[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] migration: fix multifd_send_pages() next channel
From: |
Juan Quintela |
Subject: |
Re: [PATCH] migration: fix multifd_send_pages() next channel |
Date: |
Wed, 17 Jun 2020 15:52:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) |
Laurent Vivier <lvivier@redhat.com> wrote:
> multifd_send_pages() loops around the available channels,
> the next channel to use between two calls to multifd_send_pages() is stored
> inside a local static variable, next_channel.
>
> It works well, except if the number of channels decreases between two calls
> to multifd_send_pages(). In this case, the loop can try to access the
> data of a channel that doesn't exist anymore.
>
> The problem can be triggered if we start a migration with a given number of
> channels and then we cancel the migration to restart it with a lower number.
> This ends generally with an error like:
> qemu-system-ppc64: .../util/qemu-thread-posix.c:77: qemu_mutex_lock_impl:
> Assertion `mutex->initialized' failed.
>
> This patch fixes the error by capping next_channel with the current number
> of channels before using it.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>