From: chungfengz Date: Thu, 16 Apr 2026 06:53:51 +0000 (+0000) Subject: mds: fix crash in hash_into_rank_bucket() when max_mds is 0 X-Git-Tag: v21.0.1~26^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de9db7ce99fb6b3e4810be666b0fd5e8bbb31bf7;p=ceph.git mds: fix crash in hash_into_rank_bucket() when max_mds is 0 When a CephFS cluster is paused (e.g. via `ceph fs set down true` or `ceph fs pause`) the MDS map's max_mds is set to 0. Any subsequent call to hash_into_rank_bucket() with max_mds == 0 triggers a crash: the jump-consistent-hash loop never executes (j starts at 0, condition j < max_mds is immediately false), leaving b = -1, so the final assert(result >= 0 && result < max_mds) aborts the daemon. Fixes: https://tracker.ceph.com/issues/76059 Signed-off-by: chungfengz --- diff --git a/src/mds/MDCache.cc b/src/mds/MDCache.cc index 308d1304b04..268f7122069 100644 --- a/src/mds/MDCache.cc +++ b/src/mds/MDCache.cc @@ -940,6 +940,8 @@ MDSCacheObject *MDCache::get_object(const MDSCacheObjectInfo &info) mds_rank_t MDCache::hash_into_rank_bucket(inodeno_t ino, frag_t fg) { const mds_rank_t max_mds = mds->mdsmap->get_max_mds(); + if (max_mds == 0) + return MDS_RANK_NONE; uint64_t hash = rjhash64(ino); if (fg) hash = rjhash64(hash + rjhash64(fg.value()));