Skip to contentSkip to conversation

ceph: fix incorrectly counting the export targets

PATCH New [email protected] 1 participant 1 message Aug 30, 2021 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ceph: fix incorrectly counting the export targets

From: Xiubo Li <[email protected]>

---

V2:
- s/m_num_active_mds/possible_max_rank/

 fs/ceph/mds_client.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
fs/ceph/mds_client.c +5 -3
index 7ddc36c14b92..c6451c160887 100644
@@ -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++) {
Signature · 1 line
2.27.0