@@ -2733,6 +2733,10 @@ static void cancel_con(struct ceph_connection *con)
static bool con_sock_closed(struct ceph_connection *con)
{
+ /*
+ * We want to handle the event of the socket being
+ * closed once, so clear the flag in case it is set.
+ */
if (!con_flag_test_and_clear(con, CON_FLAG_SOCK_CLOSED))
return false;
@@ -2764,6 +2768,11 @@ static bool con_backoff(struct ceph_connection *con)
{
int ret;
+ /*
+ * See if we need to back off. We only want to do this
+ * processing once each time the flag is set, so clear the
+ * flag after it's tested.
+ */
if (!con_flag_test_and_clear(con, CON_FLAG_BACKOFF))
return false;
In con_sock_closed() we test *and* clear the socket closed connection flag. It's not immediately obvious why the flag needs to be cleared. Add a comment so that's a little clearer. Similarly, we only want to do backoff processing once each time the backoff flag is set. Add a comment about that as well. Signed-off-by: Alex Elder <elder@linaro.org> --- net/ceph/messenger.c | 9 +++++++++ 1 file changed, 9 insertions(+)