[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 11/11] file-posix: handle EINTR during ioctl
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 11/11] file-posix: handle EINTR during ioctl |
Date: |
Fri, 25 Jun 2021 10:30:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 |
On 6/24/21 8:04 PM, Paolo Bonzini wrote:
> 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 <gwatson@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block/file-posix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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);
Shouldn't this use the TFR macro instead?
> if (ret == -1) {
> return -errno;
> }
>
- [PATCH 10/11] block: detect DKIOCGETBLOCKCOUNT/SIZE before use, (continued)
- [PATCH 10/11] block: detect DKIOCGETBLOCKCOUNT/SIZE before use, Paolo Bonzini, 2021/06/24
- [PATCH 09/11] block: try BSD disk size ioctls one after another, Paolo Bonzini, 2021/06/24
- [PATCH 05/11] block: add max_hw_transfer to BlockLimits, Paolo Bonzini, 2021/06/24
- [PATCH 06/11] file-posix: try BLKSECTGET on block devices too, do not round to power of 2, Paolo Bonzini, 2021/06/24
- [PATCH 08/11] block: check for sys/disk.h, Paolo Bonzini, 2021/06/24
- [PATCH 11/11] file-posix: handle EINTR during ioctl, Paolo Bonzini, 2021/06/24
- Re: [PATCH v5 00/11] block: file-posix queue, Max Reitz, 2021/06/25