From 2f78e491d7b46542158ce0b8132ee4e05bc0ade4 Mon Sep 17 00:00:00 2001 From: Chrysostomos Nanakos Date: Thu, 18 Sep 2014 14:30:49 +0300 Subject: async: aio_context_new(): Handle event_notifier_init failure On a system with a low limit of open files the initialization of the event notifier could fail and QEMU exits without printing any error information to the user. The problem can be easily reproduced by enforcing a low limit of open files and start QEMU with enough I/O threads to hit this limit. The same problem raises, without the creation of I/O threads, while QEMU initializes the main event loop by enforcing an even lower limit of open files. This commit adds an error message on failure: # qemu [...] -object iothread,id=iothread0 -object iothread,id=iothread1 qemu: Failed to initialize event notifier: Too many open files in system Signed-off-by: Chrysostomos Nanakos Signed-off-by: Stefan Hajnoczi --- qemu-nbd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'qemu-nbd.c') diff --git a/qemu-nbd.c b/qemu-nbd.c index 9bc152e6c3..de9963f8fb 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -674,7 +674,11 @@ int main(int argc, char **argv) snprintf(sockpath, 128, SOCKET_PATH, basename(device)); } - qemu_init_main_loop(); + if (qemu_init_main_loop(&local_err)) { + error_report("%s", error_get_pretty(local_err)); + error_free(local_err); + exit(EXIT_FAILURE); + } bdrv_init(); atexit(bdrv_close_all); -- cgit v1.2.3