From c4cdbd81217c0302f74ae19d22a5342e6279d0e4 Mon Sep 17 00:00:00 2001 From: Sergey Cheremencev Date: Wed, 25 Sep 2024 02:23:21 +0300 Subject: [PATCH] LU-18049 obdclass: fix class_add_nids_to_uuid Store nid in un_nids array beginning from the 0-element. Without the patch it starts from the 1st element because a counter is incremented before copying. Fixes: e4d2d4ff74 ("LU-13306 mgc: handle large NID formats") Signed-off-by: Sergey Cheremencev Change-Id: I257825de515b083df6af8b8f3ab784b48074a1fe Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56499 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/obdclass/lustre_peer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/obdclass/lustre_peer.c b/lustre/obdclass/lustre_peer.c index f8db9fc..96eb7bd 100644 --- a/lustre/obdclass/lustre_peer.c +++ b/lustre/obdclass/lustre_peer.c @@ -203,11 +203,11 @@ int class_add_nids_to_uuid(struct obd_uuid *uuid, struct lnet_nid *nidlist, if (NID_BYTES(&nidlist[i]) > nid_size) continue; - entry->un_nid_count++; memset(&entry->un_nids[entry->un_nid_count], 0, sizeof(entry->un_nids[entry->un_nid_count])); memcpy(&entry->un_nids[entry->un_nid_count], &nidlist[i], nid_size); + entry->un_nid_count++; } break; } -- 1.8.3.1