[PATCH v2 7/7] libceph: don't escalate monitor hunt backoff on EADDRNOTAVAIL

From: Ionut Nechita

Date: Fri Nov 20 2026 - 02:36:17 EST


While hunting, every reopen_session() doubles hunt_mult up to
CEPH_MONC_HUNT_MAX_MULT, so the client ends up spending 30s on each
monitor before moving to the next one. The backoff is there to avoid
hammering monitors, but when connect() fails locally with
EADDRNOTAVAIL nothing reaches the monitor and another monitor may
well be routable.

Reset hunt_mult when the monitor connection faults with
EADDRNOTAVAIL so that hunting keeps going at the base interval.

Signed-off-by: Ionut Nechita <ionut.nechita@xxxxxxxxxxxxx>
---
net/ceph/mon_client.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 2f0181b2566dc..bceeaa3690145 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -1568,6 +1568,14 @@ static void mon_fault(struct ceph_connection *con)
__schedule_delayed(monc);
} else {
dout("%s already hunting\n", __func__);
+ /*
+ * A local EADDRNOTAVAIL never reached the
+ * monitor, so there is nothing to back off from.
+ * Keep moving on to the next monitor at the
+ * base hunt interval.
+ */
+ if (con->addr_notavail)
+ monc->hunt_mult = 1;
}
}
mutex_unlock(&monc->mutex);
--
2.56.0