From: Andrew Cooper Subject: [PATCH v2 for-4.6 1/3] tools/libxl: Do not set stream->rc in stream_complete() Date: Mon, 27 Jul 2015 17:47:25 +0100 Message-ID: <1438015647-25377-2-git-send-email-andrew.cooper3@citrix.com> References: <1438015647-25377-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1438015647-25377-1-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Ian Jackson , Ian Campbell , Wei Liu List-Id: xen-devel@lists.xenproject.org Only ever set stream->rc in check_all_finished(). The first version of the migration v2 series had separate rc and joined_rc parameters, where this logic worked. However when combining the two, the teardown path fails to trigger if stream_complete() records stream->rc itself. A side effect of this is that stream_done() needs to take an rc parameter. Signed-off-by: Andrew Cooper --- CC: Ian Campbell CC: Ian Jackson CC: Wei Liu --- tools/libxl/libxl_stream_read.c | 10 ++++------ tools/libxl/libxl_stream_write.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/tools/libxl/libxl_stream_read.c b/tools/libxl/libxl_stream_read.c index 32a3551..4458aec 100644 --- a/tools/libxl/libxl_stream_read.c +++ b/tools/libxl/libxl_stream_read.c @@ -112,7 +112,7 @@ static void stream_complete(libxl__egc *egc, static void checkpoint_done(libxl__egc *egc, libxl__stream_read_state *stream, int rc); static void stream_done(libxl__egc *egc, - libxl__stream_read_state *stream); + libxl__stream_read_state *stream, int rc); static void conversion_done(libxl__egc *egc, libxl__conversion_helper_state *chs, int rc); static void check_all_finished(libxl__egc *egc, @@ -669,9 +669,7 @@ static void stream_complete(libxl__egc *egc, return; } - if (!stream->rc) - stream->rc = rc; - stream_done(egc, stream); + stream_done(egc, stream, rc); } static void checkpoint_done(libxl__egc *egc, @@ -695,7 +693,7 @@ static void checkpoint_done(libxl__egc *egc, } static void stream_done(libxl__egc *egc, - libxl__stream_read_state *stream) + libxl__stream_read_state *stream, int rc) { libxl__sr_record_buf *rec, *trec; @@ -720,7 +718,7 @@ static void stream_done(libxl__egc *egc, LIBXL_STAILQ_FOREACH_SAFE(rec, &stream->record_queue, entry, trec) free_record(rec); - check_all_finished(egc, stream, stream->rc); + check_all_finished(egc, stream, rc); } void libxl__xc_domain_restore_done(libxl__egc *egc, void *dcs_void, diff --git a/tools/libxl/libxl_stream_write.c b/tools/libxl/libxl_stream_write.c index 5bff52b..ec46105 100644 --- a/tools/libxl/libxl_stream_write.c +++ b/tools/libxl/libxl_stream_write.c @@ -55,7 +55,7 @@ static void stream_success(libxl__egc *egc, static void stream_complete(libxl__egc *egc, libxl__stream_write_state *stream, int rc); static void stream_done(libxl__egc *egc, - libxl__stream_write_state *stream); + libxl__stream_write_state *stream, int rc); static void checkpoint_done(libxl__egc *egc, libxl__stream_write_state *stream, int rc); @@ -492,13 +492,11 @@ static void stream_complete(libxl__egc *egc, return; } - if (!stream->rc) - stream->rc = rc; - stream_done(egc, stream); + stream_done(egc, stream, rc); } static void stream_done(libxl__egc *egc, - libxl__stream_write_state *stream) + libxl__stream_write_state *stream, int rc) { assert(stream->running); stream->running = false; @@ -507,7 +505,7 @@ static void stream_done(libxl__egc *egc, libxl__carefd_close(stream->emu_carefd); free(stream->emu_body); - check_all_finished(egc, stream, stream->rc); + check_all_finished(egc, stream, rc); } static void checkpoint_done(libxl__egc *egc, -- 1.7.10.4