Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2F15C432BE for ; Mon, 30 Aug 2021 12:47:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B197460524 for ; Mon, 30 Aug 2021 12:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232571AbhH3MsF (ORCPT ); Mon, 30 Aug 2021 08:48:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22810 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbhH3MsE (ORCPT ); Mon, 30 Aug 2021 08:48:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630327630; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=JD2kYNZ/gfqBkKiMeJVpvb2FtWDnQNHPdJbV4dng8sM=; b=VF/++EhhJriBJOKFplBX3+Qs9J8m4HIR0fI5jAbX4dYWiJe5+w1hwIAdlimkOh0zZxo3Ag 88r3W9UzK/60GOOC53fCY94M4mJDGpYUtgzq3y/XrwODtZHYfAnocX9pWFhs+oie6CZhzh I0PWRVaJk7dA1J5VOiQm63Hdlv6FDYA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-368-S6Fx_HDMPMOFQ1CvT1bRkg-1; Mon, 30 Aug 2021 08:47:08 -0400 X-MC-Unique: S6Fx_HDMPMOFQ1CvT1bRkg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ABBA018C89D9; Mon, 30 Aug 2021 12:47:07 +0000 (UTC) Received: from lxbceph1.gsslab.pek2.redhat.com (unknown [10.72.47.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65A6F60CA0; Mon, 30 Aug 2021 12:47:01 +0000 (UTC) From: xiubli@redhat.com To: jlayton@kernel.org Cc: idryomov@gmail.com, ukernel@gmail.com, pdonnell@redhat.com, ceph-devel@vger.kernel.org, Xiubo Li Subject: [PATCH v2] ceph: fix incorrectly counting the export targets Date: Mon, 30 Aug 2021 20:46:56 +0800 Message-Id: <20210830124656.493641-1-xiubli@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: Xiubo Li Signed-off-by: Xiubo Li --- V2: - s/m_num_active_mds/possible_max_rank/ fs/ceph/mds_client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 7ddc36c14b92..c6451c160887 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -4434,7 +4434,7 @@ static void check_new_map(struct ceph_mds_client *mdsc, struct ceph_mdsmap *newmap, struct ceph_mdsmap *oldmap) { - int i, err; + int i, j, err; int oldstate, newstate; struct ceph_mds_session *s; unsigned long targets[DIV_ROUND_UP(CEPH_MAX_MDS, sizeof(unsigned long))] = {0}; @@ -4443,8 +4443,10 @@ static void check_new_map(struct ceph_mds_client *mdsc, newmap->m_epoch, oldmap->m_epoch); if (newmap->m_info) { - for (i = 0; i < newmap->m_info->num_export_targets; i++) - set_bit(newmap->m_info->export_targets[i], targets); + for (i = 0; i < newmap->possible_max_rank; i++) { + for (j = 0; j < newmap->m_info[i].num_export_targets; j++) + set_bit(newmap->m_info[i].export_targets[j], targets); + } } for (i = 0; i < oldmap->possible_max_rank && i < mdsc->max_sessions; i++) { -- 2.27.0