From 7ad2afa43637b154afe9a8d31ac975fa74fc9a2a Mon Sep 17 00:00:00 2001 From: yury Date: Fri, 13 Oct 2006 18:08:57 +0000 Subject: [PATCH] - set in cmm mdc devices obd flags from mdt_obd in shutdown case. That should fix oops on canceling locks and make shutdown cleaner. - show obd_name in fld_client_add_target() as it is more understandable (needed for debug, seems fld targets on diff. nodes may have diff. order what is cause of really bad issues); --- lustre/cmm/cmm_object.c | 2 +- lustre/cmm/cmm_split.c | 3 ++- lustre/cmm/mdc_device.c | 43 ++++++++++++++++++++++++++++++------------- lustre/fid/fid_request.c | 2 +- lustre/fld/fld_internal.h | 2 +- lustre/fld/fld_request.c | 6 ++++++ lustre/lmv/lmv_intent.c | 2 +- lustre/lmv/lmv_obd.c | 4 ++-- 8 files changed, 44 insertions(+), 20 deletions(-) diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 86c8714..a943593 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -51,7 +51,7 @@ static int cmm_fld_lookup(struct cmm_device *cm, rc = fld_client_lookup(ls->ls_client_fld, fid_seq(fid), mds, env); if (rc) { - CERROR("can't find mds by seq "LPX64", rc %d\n", + CERROR("Can't find mds by seq "LPX64", rc %d\n", fid_seq(fid), rc); RETURN(rc); } diff --git a/lustre/cmm/cmm_split.c b/lustre/cmm/cmm_split.c index d466827..18d59c2 100644 --- a/lustre/cmm/cmm_split.c +++ b/lustre/cmm/cmm_split.c @@ -80,10 +80,11 @@ static int cmm_expect_splitting(const struct lu_env *env, if (lu_fid_eq(fid, cmm2_fid(md2cmm_obj(mo)))) GOTO(cleanup, rc = CMM_NO_SPLIT_EXPECTED); + EXIT; cleanup: if (fid) OBD_FREE_PTR(fid); - RETURN(rc); + return rc; } #define cmm_md_size(stripes) \ diff --git a/lustre/cmm/mdc_device.c b/lustre/cmm/mdc_device.c index ed8628e..84e4f23 100644 --- a/lustre/cmm/mdc_device.c +++ b/lustre/cmm/mdc_device.c @@ -138,27 +138,30 @@ static int mdc_del_obd(struct mdc_device *mc) { struct mdc_cli_desc *desc = &mc->mc_desc; struct obd_device *mdc_obd = class_exp2obd(desc->cl_exp); + struct obd_device *mdt_obd; int rc; ENTRY; - CDEBUG(D_CONFIG, "disconnect from %s\n", + CDEBUG(D_CONFIG, "Disconnect from %s\n", mdc_obd->obd_name); + /* Set mdt_obd flags in shutdown. */ + if (mdc_obd) { + mdt_obd = mc->mc_md_dev.md_lu_dev.ld_obd; + mdc_obd->obd_no_recov = mdt_obd->obd_no_recov; + mdc_obd->obd_force = mdt_obd->obd_force; + mdc_obd->obd_fail = mdt_obd->obd_fail; + } + rc = obd_fid_fini(desc->cl_exp); if (rc) - CERROR("fid init error %d \n", rc); + CERROR("Fid fini error %d\n", rc); obd_register_observer(mdc_obd, NULL); - - /*TODO: Give the same shutdown flags as we have */ - /* - desc->cl_exp->exp_obd->obd_force = mdt_obd->obd_force; - desc->cl_exp->exp_obd->obd_fail = mdt_obd->obd_fail; - */ rc = obd_disconnect(desc->cl_exp); if (rc) { - CERROR("target %s disconnect error %d\n", + CERROR("Target %s disconnect error %d\n", mdc_obd->obd_name, rc); } class_manual_cleanup(mdc_obd); @@ -168,7 +171,8 @@ static int mdc_del_obd(struct mdc_device *mc) } static int mdc_process_config(const struct lu_env *env, - struct lu_device *ld, struct lustre_cfg *cfg) + struct lu_device *ld, + struct lustre_cfg *cfg) { struct mdc_device *mc = lu2mdc_dev(ld); int rc; @@ -218,17 +222,29 @@ struct lu_device *mdc_device_alloc(const struct lu_env *env, struct lu_device_type *ldt, struct lustre_cfg *cfg) { + const char *dev = lustre_cfg_string(cfg, 0); + struct obd_device *mdt_obd; struct lu_device *ld; struct mdc_device *mc; - ENTRY; + mdt_obd = class_name2obd(dev); + LASSERT(mdt_obd != NULL); + OBD_ALLOC_PTR(mc); if (mc == NULL) { ld = ERR_PTR(-ENOMEM); } else { md_device_init(&mc->mc_md_dev, ldt); - mc->mc_md_dev.md_ops = &mdc_md_ops; + mc->mc_md_dev.md_ops = &mdc_md_ops; + + /* + * ld_obd is not used for MDC obd in cmm as it has own + * descriptor for each device. So we use it for saving mdt_obd + * to access it later in shutdown to set odb_fail, + * obd_no_recover, etc., flags. --umka + */ + mc->mc_md_dev.md_lu_dev.ld_obd = mdt_obd; ld = mdc2lu_dev(mc); ld->ld_ops = &mdc_lu_ops; } @@ -239,7 +255,8 @@ void mdc_device_free(const struct lu_env *env, struct lu_device *ld) { struct mdc_device *mc = lu2mdc_dev(ld); - LASSERTF(atomic_read(&ld->ld_ref) == 0, "Refcount = %i\n", atomic_read(&ld->ld_ref)); + LASSERTF(atomic_read(&ld->ld_ref) == 0, + "Refcount = %i\n", atomic_read(&ld->ld_ref)); LASSERT(list_empty(&mc->mc_linkage)); md_device_fini(&mc->mc_md_dev); OBD_FREE_PTR(mc); diff --git a/lustre/fid/fid_request.c b/lustre/fid/fid_request.c index c4d22e8..0884809 100644 --- a/lustre/fid/fid_request.c +++ b/lustre/fid/fid_request.c @@ -218,7 +218,7 @@ static int __seq_client_alloc_seq(struct lu_client_seq *seq, seqno_t *seqnr) "rc %d\n", seq->lcs_name, rc); RETURN(rc); } else { - CDEBUG(D_INFO|D_WARNING, "%s: New range - "DRANGE"\n", + CDEBUG(D_INFO, "%s: New range - "DRANGE"\n", seq->lcs_name, PRANGE(&seq->lcs_space)); } } diff --git a/lustre/fld/fld_internal.h b/lustre/fld/fld_internal.h index 8f7e381..ecf9907 100644 --- a/lustre/fld/fld_internal.h +++ b/lustre/fld/fld_internal.h @@ -91,7 +91,7 @@ fld_target_name(struct lu_fld_target *tar) if (tar->ft_srv != NULL) return tar->ft_srv->lsf_name; - return tar->ft_exp->exp_client_uuid.uuid; + return (const char *)tar->ft_exp->exp_obd->obd_name; } extern cfs_proc_dir_entry_t *fld_type_proc_dir; diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 4a025fb..5b19eb1 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -141,6 +141,12 @@ fld_client_get_target(struct lu_client_fld *fld, target = fld->lcf_hash->fh_scan_func(fld, seq); spin_unlock(&fld->lcf_lock); + if (target != NULL) { + CDEBUG(D_INFO, "%s: Found target (idx "LPU64 + ") by seq "LPX64"\n", fld->lcf_name, + target->ft_idx, seq); + } + RETURN(target); } diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 968b68c..2f3b296 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -254,7 +254,7 @@ repeat: it->d.lustre.it_data = 0; *reqp = NULL; - /* We shoudld reallocate the FID for the object */ + /* We shoudld reallocate the FID for the object */ rc = lmv_alloc_fid_for_split(obd, &rpid, op_data, &sop_data->fid2); if (rc) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index c68258b..110ccca 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -854,10 +854,10 @@ static int lmv_fid_alloc(struct obd_export *exp, struct lu_fid *fid, RETURN(rc); } - /* asking underlaying tgt layer to allocate new fid */ + /* Asking underlaying tgt layer to allocate new fid. */ rc = obd_fid_alloc(lmv->tgts[mds].ltd_exp, fid, hint); - /* client switches to new sequence, setup fld */ + /* Client switches to new sequence, setup fld. */ if (rc > 0) { LASSERT(fid_is_sane(fid)); -- 1.8.3.1