libmemif: don't consume rx queue interrupt, if memif_rx_burst fails
Type: fix
Signed-off-by: Jan Cavojsky <jan.cavojsky@pantheon.tech>
Change-Id: Ic6c15c88c80c4045c290cd78533be6f070c7470a
diff --git a/extras/libmemif/src/main.c b/extras/libmemif/src/main.c
index 0c4adc2..b80dd64 100644
--- a/extras/libmemif/src/main.c
+++ b/extras/libmemif/src/main.c
@@ -2506,14 +2506,18 @@
*rx = 0;
uint64_t b;
- ssize_t r = read (mq->int_fd, &b, sizeof (b));
- if (EXPECT_FALSE ((r == -1) && (errno != EAGAIN)))
- return memif_syscall_error_handler (errno);
+ ssize_t r;
cur_slot = (c->args.is_master) ? mq->last_head : mq->last_tail;
last_slot = (c->args.is_master) ? ring->head : ring->tail;
if (cur_slot == last_slot)
- return MEMIF_ERR_SUCCESS;
+ {
+ r = read (mq->int_fd, &b, sizeof (b));
+ if (EXPECT_FALSE ((r == -1) && (errno != EAGAIN)))
+ return memif_syscall_error_handler (errno);
+
+ return MEMIF_ERR_SUCCESS;
+ }
ns = last_slot - cur_slot;
@@ -2562,6 +2566,10 @@
return MEMIF_ERR_NOBUF;
}
+ r = read (mq->int_fd, &b, sizeof (b));
+ if (EXPECT_FALSE ((r == -1) && (errno != EAGAIN)))
+ return memif_syscall_error_handler (errno);
+
return MEMIF_ERR_SUCCESS; /* 0 */
}