[PATCH 2/2] libceph: don't finish hunting on auth failure in handle_auth_reply()
From: Yiming Zhu
Date: Fri Dec 04 2026 - 03:25:45 EST
In msgr1 handle_auth_reply(), when ceph_handle_auth_reply() returns a
negative error (ret < 0), finish_hunting(monc) is still called
unconditionally right after finish_auth(monc, ret, was_authed).
This clears monc->hunting, sets monc->had_a_connection = true, halves
the hunt multiplier (down to one), and schedules delayed_work() on the
ping interval as if a monitor session had been established. When
delayed_work() subsequently runs, it enters the !monc->hunting path and
calls ceph_con_keepalive() and __validate_auth() on an unauthenticated
connection.
Match the msgr2 mon_handle_auth_done() path in the same file by only
calling finish_hunting(monc) when authentication succeeded (!ret).
Cc: stable@xxxxxxxxxxxxxxx
Fixes: 0f9af169a1db ("libceph: decouple hunting and subs management")
Signed-off-by: Yiming Zhu <zhuyiming@xxxxxxxxxxxx>
---
net/ceph/mon_client.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index c56457378d00..7d0454c9278e 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -1327,7 +1327,8 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
__send_prepared_auth_request(monc, ret);
} else {
finish_auth(monc, ret, was_authed);
- finish_hunting(monc);
+ if (!ret)
+ finish_hunting(monc);
}
mutex_unlock(&monc->mutex);
}
--
2.56.1