[CRIU] [PATCH 1/5] pipes: preserve pipe packets order in the hash list

Stanislav Kinsburskiy skinsbursky at virtuozzo.com
Tue Dec 15 02:57:44 PST 2015


Current solution reverts packets order.
Correct packets sequence is important for pipes in packetized mode.

Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
---
 include/pipes.h |    1 +
 pipes.c         |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/pipes.h b/include/pipes.h
index c878616..10373f4 100644
--- a/include/pipes.h
+++ b/include/pipes.h
@@ -28,6 +28,7 @@ struct pipe_data_rst {
 	PipeDataEntry		*pde;
 	void *data;
 	struct pipe_data_rst	*next;
+	struct pipe_data_rst	*last;
 };
 
 #define PIPE_DATA_HASH_BITS	5
diff --git a/pipes.c b/pipes.c
index a155212..dfba12d 100644
--- a/pipes.c
+++ b/pipes.c
@@ -77,8 +77,14 @@ int collect_pipe_data(int img_type, struct pipe_data_rst **hash)
 			break;
 
 		ret = r->pde->pipe_id & PIPE_DATA_HASH_MASK;
-		r->next = hash[ret];
-		hash[ret] = r;
+		r->next = NULL;
+
+		if (!hash[ret])
+			hash[ret] = r;
+		else
+			hash[ret]->last->next = r;
+
+		hash[ret]->last = r;
 
 		pr_info("Collected pipe data for %#x (chain %u)\n",
 				r->pde->pipe_id, ret);



More information about the CRIU mailing list