migration: fixes for 2.10
v2 cover migration: fixes for 2.10
v2:
- patch 2: move trace_*() after error_setg_errno(). [Dan]
Two patches isolated from the postcopy recovery series, which may be good for 2.10.
Peter Xu (2):
migration: fix comment disorder in RAMState
io: fix qio_channel_socket_accept err handling
io/channel-socket.c | 3 ++- migration/ram.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 migration: fix comment disorder in RAMState
Comments for "migration_dirty_pages" and "bitmap_mutex" are switched. Fix it.
--- migration/ram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
migration/ram.c +2 -2
@@ -188,9 +188,9 @@ struct RAMState {uint64_t iterations_prev;/* Iterations since start */ uint64_t iterations; -/* protects modification of the bitmap */ -uint64_t migration_dirty_pages;/* number of dirty bits in the bitmap */ +uint64_t migration_dirty_pages; +/* protects modification of the bitmap */ QemuMutex bitmap_mutex;/* The RAMBlock used in the last src_page_requests */ RAMBlock *last_req_rb;
Signature · 1 line
2.7.4
PATCH v2 2/2 io: fix qio_channel_socket_accept err handling
In reply to Peter XuWhen accept failed, we should setup errp with the reason. More importantly, the caller may assume errp be non-NULL when error happens, and not setting the errp may crash QEMU.
At the same time, move the trace_qio_channel_socket_accept_fail() after the if check on EINTR. Two reasons:
1. when EINTR happened, it's not really a fault (we should just try again), so we should not log with an "accept failure".
2. trace_*() functions may overwrite errno, then the old errno will be missing. We need to either check errno before trace_*() calls, or reserve the errno.
--- io/channel-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
io/channel-socket.c +2 -1
@@ -340,10 +340,11 @@ qio_channel_socket_accept(QIOChannelSocket *ioc, cioc->fd =qemu_accept (ioc->fd, (struct sockaddr *)&cioc->remoteAddr, &cioc->remoteAddrLen);if (cioc->fd <0 ) { -trace_qio_channel_socket_accept_fail (ioc);if (errno ==EINTR ) { goto retry; } +error_setg_errno (errp, errno,"Unable to accept connection" ); +trace_qio_channel_socket_accept_fail (ioc); goto error; }
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH v2 2/2] io: fix qio_channel_socket_accept err handling
Quoted 25 lines · Peter Xu
When accept failed, we should setup errp with the reason. More importantly, the caller may assume errp be non-NULL when error happens, and not setting the errp may crash QEMU.
At the same time, move the
trace_qio_channel_socket_accept_fail()after the if check on EINTR. Two reasons:1. when EINTR happened, it's not really a fault (we should just try again), so we should not log with an "accept failure".
2. trace_*() functions may overwrite errno, then the old errno will be missing. We need to either check errno before trace_*() calls, or reserve the errno.
Signed-off-by Peter Xu <[email protected]>--- io/channel-socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)io/channel-socket.c +0
-0@@ -340,10 +340,11 @@ qio_channel_socket_accept(QIOChannelSocket *ioc, cioc->fd = qemu_accept(ioc->fd, (struct sockaddr *)&cioc->remoteAddr,
io/channel-socket.c qio_channel_socket_accept(QIOChannelSocket *ioc, · line 349
Quoted 10 lines
io/channel-socket.c +2
-1&cioc->remoteAddrLen);if (cioc->fd <0 ) { -trace_qio_channel_socket_accept_fail (ioc);if (errno ==EINTR ) { goto retry; } +error_setg_errno (errp, errno,"Unable to accept connection" ); +trace_qio_channel_socket_accept_fail (ioc); goto error; }
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Quoted 5 lines · * Peter Xu ([email protected]) wrote:
v2:
- patch 2: move trace_*() aftererror_setg_errno(). [Dan]Two patches isolated from the postcopy recovery series, which may be good for 2.10.
Queued
Quoted 11 lines
Peter Xu (2):
migration: fix comment disorder in RAMState
io: fixqio_channel_socket_accepterr handlingio/channel-socket.c | 3 ++- migration/ram.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)Signature · 1 line
2.7.4
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK