From: Jinshan Xiong Date: Tue, 13 Nov 2012 19:56:17 +0000 (-0800) Subject: LU-2031 obdclass: check if client is connected to the target X-Git-Tag: 2.3.57~51 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=81fa7775360302c7dfeb08ab708969b6a9287bd0;p=fs%2Flustre-release.git LU-2031 obdclass: check if client is connected to the target 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 Change-Id: Ia144b695443a9850ecccd0c8946de029492b4446 Reviewed-on: http://review.whamcloud.com/4525 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Oleg Drokin --- diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index bf02e4e..e293fa0 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -1371,11 +1371,20 @@ static int mgc_apply_recover_logs(struct obd_device *mgc, 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]));