Whamcloud - gitweb
LU-5950 mgc: add nid iteration 29/12829/3
authorAlexander.Boyko <alexander_boyko@xyratex.com>
Mon, 24 Nov 2014 10:55:15 +0000 (13:55 +0300)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 4 Dec 2014 13:32:48 +0000 (13:32 +0000)
mgc_apply_recover_logs use only first nid from entry,
this could be the problem for a cluster with several network
address for a one node.

Signed-off-by: Alexander Boyko <alexander.boyko@seagate.com>
Change-Id: I6ec348761c2d51edd613cb388e37ef7776990424
Xyratex-bug-id: MRP-2255
Reviewed-on: http://review.whamcloud.com/12829
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Ann Koehler <amk@cray.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre/mgc/mgc_request.c

index 1788874..347590f 100644 (file)
@@ -1394,7 +1394,7 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
 
         while (datalen > 0) {
                 int   entry_len = sizeof(*entry);
 
         while (datalen > 0) {
                 int   entry_len = sizeof(*entry);
-                int   is_ost;
+               int   is_ost, i;
                 struct obd_device *obd;
                 char *obdname;
                 char *cname;
                 struct obd_device *obd;
                 char *obdname;
                 char *cname;
@@ -1500,11 +1500,17 @@ static int mgc_apply_recover_logs(struct obd_device *mgc,
                        continue;
                }
 
                        continue;
                }
 
-                /* TODO: iterate all nids to find one */
-                /* find uuid by nid */
-                rc = client_import_find_conn(obd->u.cli.cl_import,
-                                             entry->u.nids[0],
-                                             (struct obd_uuid *)uuid);
+               /* iterate all nids to find one */
+               /* find uuid by nid */
+               rc = -ENOENT;
+               for (i = 0; i < entry->mne_nid_count; i++) {
+                       rc = client_import_find_conn(obd->u.cli.cl_import,
+                                                    entry->u.nids[i],
+                                                    (struct obd_uuid *)uuid);
+                       if (rc == 0)
+                               break;
+               }
+
                up_read(&obd->u.cli.cl_sem);
                 if (rc < 0) {
                         CERROR("mgc: cannot find uuid by nid %s\n",
                up_read(&obd->u.cli.cl_sem);
                 if (rc < 0) {
                         CERROR("mgc: cannot find uuid by nid %s\n",