When the client is notified by IR, it may not connect to the OST
yet, verify it before writing the new NID to the import.
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ia144b695443a9850ecccd0c8946de029492b4446
Reviewed-on: http://review.whamcloud.com/4525
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
pos += sprintf(params, "%s.import=%s", cname, "connection=");
uuid = buf + pos;
+ cfs_down_read(&obd->u.cli.cl_sem);
+ if (obd->u.cli.cl_import == NULL) {
+ /* client does not connect to the OST yet */
+ cfs_up_read(&obd->u.cli.cl_sem);
+ rc = 0;
+ 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);
+ cfs_up_read(&obd->u.cli.cl_sem);
if (rc < 0) {
CERROR("mgc: cannot find uuid by nid %s\n",
libcfs_nid2str(entry->u.nids[0]));