From 86363f06da5f562c8a575098e48913a65ff83953 Mon Sep 17 00:00:00 2001
From: Dennis Potter <dennis@dennispotter.eu>
Date: Wed, 4 Jul 2018 15:37:25 +0200
Subject: [PATCH] Added better handling for FLUSH_ERRs of receive work queue

---
 lib/nodes/infiniband.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/nodes/infiniband.c b/lib/nodes/infiniband.c
index cb63e01ee..8e35952a9 100644
--- a/lib/nodes/infiniband.c
+++ b/lib/nodes/infiniband.c
@@ -744,10 +744,18 @@ int ib_read(struct node *n, struct sample *smps[], unsigned cnt)
 
 		for(int i=0; i<ret; i++)
 		{
-			if(wc[i].status != IBV_WC_SUCCESS)
+			if(wc[i].status == IBV_WC_WR_FLUSH_ERR)
+			{
+				//ToDo: create debug entry
+				ret = 0;
+			}
+			else if(wc[i].status != IBV_WC_SUCCESS)
+			{
 				warn("Work Completion status was not IBV_WC_SUCCES in node %s: %i",
 					node_name(n), wc[i].status);
-			else if(wc[i].opcode & IBV_WC_RECV && wc[i].status != IBV_WC_WR_FLUSH_ERR)
+				ret = 0;
+			}
+			else if(wc[i].opcode & IBV_WC_RECV)
 			{
 				smps[i] = (struct sample*)(wc[i].wr_id);
 				smps[i]->length = wc[i].byte_len/sizeof(double);