In multifd_queue_page() MultiFDPages_t.block is checked twice.
Between the two checks, MultiFDPages_t.block may be reset to NULL
by multifd thread. This lead to the 2nd check always true then a
redundant page submitted to multifd thread again.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
int multifd_queue_page(QEMUFile *f, RAMBlock *block, ram_addr_t offset)
{
MultiFDPages_t *pages = multifd_send_state->pages;
+ bool changed = false;
if (!pages->block) {
pages->block = block;
if (pages->num < pages->allocated) {
return 1;
}
+ } else {
+ changed = true;
}
if (multifd_send_pages(f) < 0) {
return -1;
}
- if (pages->block != block) {
- return multifd_queue_page(f, block, offset);
+ if (changed) {
+ return multifd_queue_page(f, block, offset);
}
return 1;