From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E1B847FAEA; Thu, 20 Aug 2026 17:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787246960; cv=none; b=lt0zzPgm1smBnywlxJpiGqse7FwYR+KFj5Ef9/G+0xU2jqeSV3IsV1ikixn1KEOIhzJSB04T+gX0W3ZiQnFge/4bEy9a19r0zxy7SZn9JNRsJfnyiTU5c1baSmV08rWFzXs6APT3PdCKFNsGXgugAMssgcS9ptFEwS5YgaZEok4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787246960; c=relaxed/simple; bh=etxTBkL4TFU8o7hZ9KQBxUEv7KgHq0G1sGyZ1pcks6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XayojXUqaLjLO+u+dudOLPRRXKNGOFXHuhKE76h9PsebFRYmnO8+NXFMVZ4Xi2VDZJKUNF46USuZ/mRwVspqYxx81CWKCYRl2U5maDe0RaGJyFdkAheG+32k1UiCKwG+Pa1bnhdAsBta6Eraz4lYHJHFNaIIwNHHgzt95HUubKk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=t8kCaDG7; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="t8kCaDG7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F7A11F000E9; Thu, 20 Aug 2026 17:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1787246958; bh=9v9ZllcY6Lnzi2b7A6VT4uCJ51Y52Vzn1e9KbSRRf10=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=t8kCaDG78c6eBosXrEYTMQTCNAmU7vS9JgV/elZyJMLYjXHLdBgWRSFciEZ9/2guY XHqp+dHr+thCR+9beIyUY2Eoix6l4e0nv8lL9GSBIli1pjOFxYHG7f/eYsxjv/Cqkr PBxinVpSrzRqa+zbIMywgWtKAdGzWla/Sbfr/IRE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yiming Zhu , Viacheslav Dubeyko , Ilya Dryomov Subject: [PATCH 6.12 061/220] ceph: fix MDS random selection readiness predicate Date: Thu, 20 Aug 2026 16:54:11 +0200 Message-ID: <20260820145225.322928770@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260820145223.480031205@linuxfoundation.org> References: <20260820145223.480031205@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yiming Zhu commit 2c11c4bfdb7bd2808b3b3ac228e1f2d9bcf25457 upstream. CEPH_MDS_IS_READY() is parsed so that the ternary expression can return true for an MDS entry with state 0 when it is not laggy. This allows the random selector to choose a down/DNE rank. Group the ternary expression under the state check so zero-state ranks are not treated as ready. Cc: stable@vger.kernel.org Fixes: b38c9eb4757d ("ceph: add possible_max_rank and make the code more readable") Link: https://tracker.ceph.com/issues/78648 Signed-off-by: Yiming Zhu Reviewed-by: Viacheslav Dubeyko Signed-off-by: Ilya Dryomov Signed-off-by: Greg Kroah-Hartman --- fs/ceph/mdsmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/ceph/mdsmap.c +++ b/fs/ceph/mdsmap.c @@ -15,7 +15,7 @@ #include "super.h" #define CEPH_MDS_IS_READY(i, ignore_laggy) \ - (m->m_info[i].state > 0 && ignore_laggy ? true : !m->m_info[i].laggy) + (m->m_info[i].state > 0 && (ignore_laggy ? true : !m->m_info[i].laggy)) static int __mdsmap_get_random_mds(struct ceph_mdsmap *m, bool ignore_laggy) {