check_timeout() is called whenever it's time to handle a client, and if
it detects a timeout, it will switch to the CLT_SEND state.  However it
may already be in the CLT_SEND state, and may have already sent the
length, and possibly some data. Restarting the CLT_SEND state will cause
it to restart sending the length, messing up communication with the
client. If we are already sending a reply to the client, we should just
finish the send. Disable timeouts in the CLT_SEND state.

Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com>
---
 multipathd/uxlsnr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/multipathd/uxlsnr.c b/multipathd/uxlsnr.c
index 04bcd020..23cb123d 100644
--- a/multipathd/uxlsnr.c
+++ b/multipathd/uxlsnr.c
@@ -405,10 +405,11 @@ static void set_client_state(struct client *c, int state)
        case CLT_RECV:
                reset_strbuf(&c->reply);
                memset(c->cmd, '\0', sizeof(c->cmd));
-               c->expires = ts_zero;
                c->error = 0;
                /* fallthrough */
        case CLT_SEND:
+               /* no timeout while waiting for the client or sending a reply */
+               c->expires = ts_zero;
                /* reuse these fields for next data transfer */
                c->len = c->cmd_len = 0;
                break;
-- 
2.17.2

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to