Close the control socket during cleanup

This should prevent further requests coming in, triggering deadlocks.
This commit is contained in:
Patrick J Cherry
2018-12-07 15:02:55 +00:00
parent ce9499efce
commit 70a3a4bb55
2 changed files with 6 additions and 10 deletions

View File

@@ -827,6 +827,11 @@ void serve_cleanup(struct server *params,
close(params->server_fd);
}
/* close the control socket too */
if (params->flexnbd && params->flexnbd->control) {
control_signal_close(params->flexnbd->control);
}
/* need to stop background build if we're killed very early on */
pthread_cancel(params->allocation_map_builder_thread);
pthread_join(params->allocation_map_builder_thread, &status);
@@ -861,15 +866,6 @@ void serve_cleanup(struct server *params,
server_unlock_acl(params);
}
/* if( params->flexnbd ) { */
/* if ( params->flexnbd->control ) { */
/* flexnbd_stop_control( params->flexnbd ); */
/* } */
/* flexnbd_destroy( params->flexnbd ); */
/* } */
/* server_destroy( params ); */
debug("Cleanup done");
}

View File

@@ -114,7 +114,7 @@ class TestWriteDuringMigration < Test::Unit::TestCase
sock.flush
sock.readline
end
rescue Errno::ENOENT
rescue StandardError
# If the socket disappears, that's OK.
break
end