Whamcloud - gitweb
LU-18049 obdclass: fix class_add_nids_to_uuid 99/56499/2
authorSergey Cheremencev <scherementsev@ddn.com>
Tue, 24 Sep 2024 23:23:21 +0000 (02:23 +0300)
committerOleg Drokin <green@whamcloud.com>
Fri, 27 Sep 2024 23:55:12 +0000 (23:55 +0000)
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 <scherementsev@ddn.com>
Change-Id: I257825de515b083df6af8b8f3ab784b48074a1fe
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56499
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/lustre_peer.c

index f8db9fc..96eb7bd 100644 (file)
@@ -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;
        }