mirror: Don't start migrating until the allocation map is built
There is a fun race that can happen if we begin migrating while the allocation map is still building. We call bitset_enable_stream() when the migration begins, which causes the builder to start putting events into the stream. This is bad all by itself, as it slows the migration down for no reason, but the stream is a limited-size queue and there are situations (migration fails and is restarted) where we can end up with the queue full and nobody able to empty it, freezing the whole thing.
This commit is contained in:
@@ -76,8 +76,10 @@ struct server {
|
||||
struct bitset * allocation_map;
|
||||
/* when starting up, this thread builds the allocation_map */
|
||||
pthread_t allocation_map_builder_thread;
|
||||
|
||||
/* when the thread has finished, it sets this to 1 */
|
||||
volatile sig_atomic_t allocation_map_built;
|
||||
volatile sig_atomic_t allocation_map_not_built;
|
||||
|
||||
int max_nbd_clients;
|
||||
struct client_tbl_entry *nbd_client;
|
||||
|
Reference in New Issue
Block a user