migration: fixes for 2.10
cover migration: fixes for 2.10
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 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
Re: [Qemu-devel] [PATCH 1/2] migration: fix comment disorder in RAMState
Quoted 5 lines · Peter Xu
Comments for "
migration_dirty_pages" and "bitmap_mutex" are switched. Fix it.Reviewed-by Dr. David Alan Gilbert <[email protected]>Signed-off-by Peter Xu <[email protected]>
PATCH 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; } +trace_qio_channel_socket_accept_fail (ioc); +error_setg_errno (errp, errno,"Unable to accept connection" ); goto error; }
Signature · 1 line
2.7.4
Re: [Qemu-devel] [PATCH 2/2] io: fix qio_channel_socket_accept err handling
Quoted 7 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:
Quoted 8 lines
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]>
Re: [Qemu-devel] [PATCH 2/2] io: fix qio_channel_socket_accept err handling
In reply to Peter XuQuoted 24 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
io/channel-socket.c qio_channel_socket_accept(QIOChannelSocket *ioc, · line 347
Quoted 9 lines
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; } +trace_qio_channel_socket_accept_fail (ioc); +error_setg_errno (errp, errno,"Unable to accept connection" );
Err, you're still clobbering errno in trace_qio_channel_socket_accept_fail before calling error_setg_errno
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 :|
Re: [Qemu-devel] [PATCH 2/2] io: fix qio_channel_socket_accept err handling
Quoted 29 lines · Daniel P. Berrange
Quoted 28 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
-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);
Quoted 8 lines
io/channel-socket.c qio_channel_socket_accept(QIOChannelSocket *ioc, · line 347
Quoted 5 lines
io/channel-socket.c +2
-0if (errno ==EINTR ) { goto retry; } +trace_qio_channel_socket_accept_fail (ioc); +error_setg_errno (errp, errno,"Unable to accept connection" );Err, you're still clobbering errno in
trace_qio_channel_socket_accept_failbefore callingerror_setg_errno
Oops! I'll do a quick respin. Thanks for pointing out.
Signature · 1 line
Peter Xu