From f99bee740a542576f450e848c96952b346c1e0e8 Mon Sep 17 00:00:00 2001 From: Patience Warnick Date: Thu, 24 Jan 2008 11:10:09 -0800 Subject: [PATCH] Added STANDBY state for a connection --- src/kernel/messenger.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/kernel/messenger.c b/src/kernel/messenger.c index 685f7942543c1..6c1849b8db993 100644 --- a/src/kernel/messenger.c +++ b/src/kernel/messenger.c @@ -284,13 +284,20 @@ static void ceph_send_fault(struct ceph_connection *con) set_bit(NEW, &con->state); clear_bit(CLOSED, &con->state); sock_release(con->sock); - /* retry with delay */ - ceph_queue_delayed_write(con); - if (con->delay < MAX_DELAY_INTERVAL) - con->delay *= 2; - else - con->delay = MAX_DELAY_INTERVAL; + /* If there are no messages in the queue, place the connection + * in a STANDBY state otherwise retry with delay */ + if (list_empty(&con->out_queue)) { + set_bit(STANDBY, &con->state); + } else { + /* retry with delay */ + ceph_queue_delayed_write(con); + + if (con->delay < MAX_DELAY_INTERVAL) + con->delay *= 2; + else + con->delay = MAX_DELAY_INTERVAL; + } } @@ -552,7 +559,6 @@ more: /* hmm, nothing to do! No more writes pending? */ dout(30, "try_write nothing else to write.\n"); spin_unlock(&con->out_queue_lock); - /* TBD PW remove from wait queue if still there.. and put_connection */ if (con->delay > 1) con->delay = BASE_DELAY_INTERVAL; goto done; } -- 2.39.5