Re: [Xen-devel] [PATCH v2 for-4.6 1/3] tools/libxl: Do not set stream-rc in stream_complete()

2015-07-28 Thread Ian Jackson
Andrew Cooper writes ([PATCH v2 for-4.6 1/3] tools/libxl: Do not set 
stream-rc in stream_complete()):
 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.

Acked-by: Ian Jackson ian.jack...@eu.citrix.com

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH v2 for-4.6 1/3] tools/libxl: Do not set stream-rc in stream_complete()

2015-07-27 Thread Andrew Cooper
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 andrew.coop...@citrix.com
---
CC: Ian Campbell ian.campb...@citrix.com
CC: Ian Jackson ian.jack...@eu.citrix.com
CC: Wei Liu wei.l...@citrix.com
---
 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


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel