Re: [PATCH] ceph: fix mds random selection readiness predicate

Ilya Dryomov <[email protected]> Mon, 27 Jul 2026 10:44:04 +0200
Newsgroups org.kernel.vger.ceph-devel,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CAOi1vP9D1RbVkKLg1P+4ia1T+0QiwXp2hxOgnN6u=S7EVU5J3g@mail.gmail.com>
On Fri, Jul 24, 2026 at 7:59=E2=80=AFPM Viacheslav Dubeyko <[email protected]=
om> wrote:
>
> On Fri, 2026-07-24 at 11:40 +0000, =E6=9C=B1=E4=B8=80=E9=B8=A3 wrote:
> > Adding the current Ceph client maintainer list
> >
> > > On Jul 24, 2026, at 18:49, =E6=9C=B1=E4=B8=80=E9=B8=A3 <zhuyiming@kua=
ishou.com> wrote:
> > >
> > > 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.
> > >
> > > Fixes: b38c9eb4757d ("ceph: allow choose random mds")
> > > Cc: [email protected]
> > > Link: https://tracker.ceph.com/issues/78648
> > > Signed-off-by: Yiming Zhu <[email protected]>
> > > ---
> > > fs/ceph/mdsmap.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
> > > index d8e46eb7e5eb..450a4dc9662e 100644
> > > --- 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)
> > > {
> > >
> > > base-commit: 48a5a7ab8d6ab7090564339e039c421f315de912
> > > --
> > > 2.55.0
> > >
>
> Good catch.
>
> Reviewed-by: Viacheslav Dubeyko <[email protected]>

Applied.

Thanks,

                Ilya