From: Paolo Bonzini Date: Tue, 15 Jun 2021 06:34:52 +0000 (+0200) Subject: file-posix: handle EINTR during ioctl X-Git-Tag: qemu-xen-4.16.0-rc4~103^2~5 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bd80936a4f18075e0e407df180801a9743ce290c;p=qemu-xen.git file-posix: handle EINTR during ioctl Similar to other handle_aiocb_* functions, handle_aiocb_ioctl needs to cater for the possibility that ioctl is interrupted by a signal. Otherwise, the I/O is incorrectly reported as a failure to the guest. Reported-by: Gordon Watson Signed-off-by: Paolo Bonzini --- diff --git a/block/file-posix.c b/block/file-posix.c index 74b8216077..a26eab0ac3 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1347,7 +1347,9 @@ static int handle_aiocb_ioctl(void *opaque) RawPosixAIOData *aiocb = opaque; int ret; - ret = ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf); + do { + ret = ioctl(aiocb->aio_fildes, aiocb->ioctl.cmd, aiocb->ioctl.buf); + } while (ret == -1 && errno == EINTR); if (ret == -1) { return -errno; }