From: wang di Date: Fri, 24 Jan 2014 22:21:07 +0000 (-0800) Subject: LU-4413 osp: move seq allocation out of osp_import_event X-Git-Tag: 2.5.2-RC1~46 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=ed82a26746d22;p=fs%2Flustre-release.git LU-4413 osp: move seq allocation out of osp_import_event Because seq allocation(osp_init_pre_fid) might be stuck during RPC, move it out of osp_import_event, which is inside ptlrpcd_rcv. Otherwise, some other import RPCs(like connect req)might be blocked in ptlrpcd_rcv. Lustre-commit: 9b643f4f54c3e9e0c07c2211904a72ad9c4f823f Lustre-change: http://review.whamcloud.com/8997 Signed-off-by: wang di Signed-off-by: Bob Glossman Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Change-Id: Ia41487d7859ec2cf8f0033dd97c7df98a18dcded Reviewed-on: http://review.whamcloud.com/9875 Tested-by: Jenkins Reviewed-by: Mike Pershin Tested-by: Maloo --- diff --git a/lustre/osp/osp_dev.c b/lustre/osp/osp_dev.c index 3972cbb..a4a2f90 100644 --- a/lustre/osp/osp_dev.c +++ b/lustre/osp/osp_dev.c @@ -859,6 +859,18 @@ static int osp_reconnect(const struct lu_env *env, return 0; } +static int osp_prepare_fid_client(struct osp_device *osp) +{ + LASSERT(osp->opd_obd->u.cli.cl_seq != NULL); + if (osp->opd_obd->u.cli.cl_seq->lcs_exp != NULL) + return 0; + + LASSERT(osp->opd_exp != NULL); + osp->opd_obd->u.cli.cl_seq->lcs_exp = + class_export_get(osp->opd_exp); + return 0; +} + /* * we use exports to track all LOD users */ @@ -1040,6 +1052,10 @@ static int osp_import_event(struct obd_device *obd, struct obd_import *imp, break; case IMP_EVENT_ACTIVE: d->opd_imp_active = 1; + + if (osp_prepare_fid_client(d) != 0) + break; + if (d->opd_got_disconnected) d->opd_new_connection = 1; d->opd_imp_connected = 1; diff --git a/lustre/osp/osp_precreate.c b/lustre/osp/osp_precreate.c index c1c9e6b..6de6ead 100644 --- a/lustre/osp/osp_precreate.c +++ b/lustre/osp/osp_precreate.c @@ -912,19 +912,18 @@ static int osp_precreate_thread(void *_arg) break; LASSERT(d->opd_obd->u.cli.cl_seq != NULL); - if (d->opd_obd->u.cli.cl_seq->lcs_exp == NULL) { - /* Get new sequence for client first */ - LASSERT(d->opd_exp != NULL); - d->opd_obd->u.cli.cl_seq->lcs_exp = - class_export_get(d->opd_exp); - rc = osp_init_pre_fid(d); - if (rc != 0) { - class_export_put(d->opd_exp); - d->opd_obd->u.cli.cl_seq->lcs_exp = NULL; - CERROR("%s: init pre fid error: rc = %d\n", - d->opd_obd->obd_name, rc); - continue; - } + /* Sigh, fid client is not ready yet */ + if (d->opd_obd->u.cli.cl_seq->lcs_exp == NULL) + continue; + + /* Init fid for osp_precreate if necessary */ + rc = osp_init_pre_fid(d); + if (rc != 0) { + class_export_put(d->opd_exp); + d->opd_obd->u.cli.cl_seq->lcs_exp = NULL; + CERROR("%s: init pre fid error: rc = %d\n", + d->opd_obd->obd_name, rc); + continue; } osp_statfs_update(d);