From: fanyong Date: Fri, 28 Nov 2008 15:01:22 +0000 (+0000) Subject: Branch HEAD X-Git-Tag: v1_9_120~48 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;ds=sidebyside;h=11127cbfc4b9a184376a054a60a268d3e4b214b9;p=fs%2Flustre-release.git Branch HEAD b=17752 i=yury.umanets i=tianzy Disable quota support for CMD case temporary. --- diff --git a/lustre/cmm/cmm_device.c b/lustre/cmm/cmm_device.c index 08a435e..01f319d 100644 --- a/lustre/cmm/cmm_device.c +++ b/lustre/cmm/cmm_device.c @@ -137,10 +137,6 @@ static int cmm_quota_notify(const struct lu_env *env, struct md_device *m) int rc; ENTRY; - /* disable quota for CMD case temporary. */ - if (cmm_dev->cmm_tgt_count) - RETURN(-EOPNOTSUPP); - rc = cmm_child_ops(cmm_dev)->mdo_quota.mqo_notify(env, cmm_dev->cmm_child); RETURN(rc); @@ -153,10 +149,6 @@ static int cmm_quota_setup(const struct lu_env *env, struct md_device *m, int rc; ENTRY; - /* disable quota for CMD case temporary. */ - if (cmm_dev->cmm_tgt_count) - RETURN(-EOPNOTSUPP); - rc = cmm_child_ops(cmm_dev)->mdo_quota.mqo_setup(env, cmm_dev->cmm_child, data); @@ -169,10 +161,6 @@ static int cmm_quota_cleanup(const struct lu_env *env, struct md_device *m) int rc; ENTRY; - /* disable quota for CMD case temporary. */ - if (cmm_dev->cmm_tgt_count) - RETURN(-EOPNOTSUPP); - rc = cmm_child_ops(cmm_dev)->mdo_quota.mqo_cleanup(env, cmm_dev->cmm_child); RETURN(rc); @@ -184,10 +172,6 @@ static int cmm_quota_recovery(const struct lu_env *env, struct md_device *m) int rc; ENTRY; - /* disable quota for CMD case temporary. */ - if (cmm_dev->cmm_tgt_count) - RETURN(-EOPNOTSUPP); - rc = cmm_child_ops(cmm_dev)->mdo_quota.mqo_recovery(env, cmm_dev->cmm_child); RETURN(rc); @@ -211,7 +195,7 @@ static int cmm_quota_check(const struct lu_env *env, struct md_device *m, } static int cmm_quota_on(const struct lu_env *env, struct md_device *m, - __u32 type, __u32 id) + __u32 type) { struct cmm_device *cmm_dev = md2cmm_dev(m); int rc; @@ -223,12 +207,12 @@ static int cmm_quota_on(const struct lu_env *env, struct md_device *m, rc = cmm_child_ops(cmm_dev)->mdo_quota.mqo_on(env, cmm_dev->cmm_child, - type, id); + type); RETURN(rc); } static int cmm_quota_off(const struct lu_env *env, struct md_device *m, - __u32 type, __u32 id) + __u32 type) { struct cmm_device *cmm_dev = md2cmm_dev(m); int rc; @@ -240,7 +224,7 @@ static int cmm_quota_off(const struct lu_env *env, struct md_device *m, rc = cmm_child_ops(cmm_dev)->mdo_quota.mqo_off(env, cmm_dev->cmm_child, - type, id); + type); RETURN(rc); } @@ -449,6 +433,9 @@ static int cmm_add_mdc(const struct lu_env *env, mdsno_t mdc_num; struct lu_site *site = cmm2lu_dev(cm)->ld_site; int rc; +#ifdef HAVE_QUOTA_SUPPORT + int first; +#endif ENTRY; /* find out that there is no such mdc */ @@ -500,6 +487,9 @@ static int cmm_add_mdc(const struct lu_env *env, mc = lu2mdc_dev(ld); list_add_tail(&mc->mc_linkage, &cm->cmm_targets); cm->cmm_tgt_count++; +#ifdef HAVE_QUOTA_SUPPORT + first = cm->cmm_tgt_count; +#endif spin_unlock(&cm->cmm_tgt_guard); lu_device_get(cmm_lu); @@ -517,6 +507,13 @@ static int cmm_add_mdc(const struct lu_env *env, lu_site2md(site)->ms_server_fld->lsf_control_exp = mc->mc_desc.cl_exp; } +#ifdef HAVE_QUOTA_SUPPORT + /* XXX: Disable quota for CMD case temporary. */ + if (first == 1) { + CWARN("Disable quota for CMD case temporary!\n"); + cmm_child_ops(cm)->mdo_quota.mqo_off(env, cm->cmm_child, UGQUOTA); + } +#endif /* Set max md size for the mdc. */ rc = cmm_post_init_mdc(env, cm); RETURN(rc); diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index 718e336..640ad6d 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -344,13 +344,11 @@ struct md_device_operations { int (*mqo_on)(const struct lu_env *env, struct md_device *m, - __u32 type, - __u32 id); + __u32 type); int (*mqo_off)(const struct lu_env *env, struct md_device *m, - __u32 type, - __u32 id); + __u32 type); int (*mqo_setinfo)(const struct lu_env *env, struct md_device *m, diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index aa2f6f6..d6729e2 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -319,9 +319,9 @@ int mdd_quota_recovery(const struct lu_env *env, struct md_device *m); int mdd_quota_check(const struct lu_env *env, struct md_device *m, struct obd_export *exp, __u32 type); int mdd_quota_on(const struct lu_env *env, struct md_device *m, - __u32 type, __u32 id); + __u32 type); int mdd_quota_off(const struct lu_env *env, struct md_device *m, - __u32 type, __u32 id); + __u32 type); int mdd_quota_setinfo(const struct lu_env *env, struct md_device *m, __u32 type, __u32 id, struct obd_dqinfo *dqinfo); int mdd_quota_getinfo(const struct lu_env *env, const struct md_device *m, diff --git a/lustre/mdd/mdd_quota.c b/lustre/mdd/mdd_quota.c index 7bc92cc..d246a07 100644 --- a/lustre/mdd/mdd_quota.c +++ b/lustre/mdd/mdd_quota.c @@ -107,7 +107,7 @@ int mdd_quota_check(const struct lu_env *env, struct md_device *m, } int mdd_quota_on(const struct lu_env *env, struct md_device *m, - __u32 type, __u32 id) + __u32 type) { struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); struct obd_device *obd = mdd->mdd_obd_dev; @@ -117,13 +117,12 @@ int mdd_quota_on(const struct lu_env *env, struct md_device *m, oqctl->qc_cmd = Q_QUOTAON; oqctl->qc_type = type; - oqctl->qc_id = id; rc = lquota_ctl(mds_quota_interface_ref, obd, oqctl); RETURN(rc); } int mdd_quota_off(const struct lu_env *env, struct md_device *m, - __u32 type, __u32 id) + __u32 type) { struct mdd_device *mdd = lu2mdd_dev(&m->md_lu_dev); struct obd_device *obd = mdd->mdd_obd_dev; @@ -133,7 +132,6 @@ int mdd_quota_off(const struct lu_env *env, struct md_device *m, oqctl->qc_cmd = Q_QUOTAOFF; oqctl->qc_type = type; - oqctl->qc_id = id; rc = lquota_ctl(mds_quota_interface_ref, obd, oqctl); RETURN(rc); } diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index c7932bf..0aaea1b 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -1729,10 +1729,10 @@ static int mdt_quotactl_handle(struct mdt_thread_info *info) switch (oqctl->qc_cmd) { case Q_QUOTAON: - rc = mqo->mqo_on(info->mti_env, next, oqctl->qc_type, id); + rc = mqo->mqo_on(info->mti_env, next, oqctl->qc_type); break; case Q_QUOTAOFF: - rc = mqo->mqo_off(info->mti_env, next, oqctl->qc_type, id); + rc = mqo->mqo_off(info->mti_env, next, oqctl->qc_type); break; case Q_SETINFO: rc = mqo->mqo_setinfo(info->mti_env, next, oqctl->qc_type, id, diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index f4374b7..5e1c51b 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -526,6 +526,11 @@ static int mds_quota_setup(struct obd_device *obd) int rc; ENTRY; + if (unlikely(mds->mds_quota)) { + CWARN("try to reinitialize quota context!\n"); + RETURN(0); + } + init_rwsem(&obt->obt_rwsem); obt->obt_qfmt = LUSTRE_QUOTA_V2; mds->mds_quota_info.qi_version = LUSTRE_QUOTA_V2; @@ -544,7 +549,9 @@ static int mds_quota_setup(struct obd_device *obd) static int mds_quota_cleanup(struct obd_device *obd) { ENTRY; - obd->u.mds.mds_quota = 0; + if (unlikely(!obd->u.mds.mds_quota)) + RETURN(0); + qctxt_cleanup(&obd->u.obt.obt_qctxt, 0); RETURN(0); } @@ -554,6 +561,9 @@ static int mds_quota_setinfo(struct obd_device *obd, void *data) struct lustre_quota_ctxt *qctxt = &obd->u.obt.obt_qctxt; ENTRY; + if (unlikely(!obd->u.mds.mds_quota)) + RETURN(0); + if (data != NULL) QUOTA_MASTER_READY(qctxt); else @@ -567,6 +577,10 @@ static int mds_quota_fs_cleanup(struct obd_device *obd) struct obd_quotactl oqctl; ENTRY; + if (unlikely(!mds->mds_quota)) + RETURN(0); + + mds->mds_quota = 0; memset(&oqctl, 0, sizeof(oqctl)); oqctl.qc_type = UGQUOTA; diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index 512fc49..20b91f9 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -1597,11 +1597,15 @@ free: int mds_quota_recovery(struct obd_device *obd) { - struct lov_obd *lov = &obd->u.mds.mds_osc_obd->u.lov; + struct mds_obd *mds = &obd->u.mds; + struct lov_obd *lov = &mds->mds_osc_obd->u.lov; struct qmaster_recov_thread_data data; int rc = 0; ENTRY; + if (unlikely(!mds->mds_quota)) + RETURN(rc); + mutex_down(&lov->lov_lock); if (lov->desc.ld_tgt_count != lov->desc.ld_active_tgt_count) { CWARN("Not all osts are active, abort quota recovery\n"); diff --git a/lustre/tests/sanity-quota.sh b/lustre/tests/sanity-quota.sh index 76649e7..634ecf1 100644 --- a/lustre/tests/sanity-quota.sh +++ b/lustre/tests/sanity-quota.sh @@ -49,6 +49,7 @@ init_test_env $@ . ${CONFIG:=$LUSTRE/tests/cfg/$NAME.sh} DIRECTIO=${DIRECTIO:-$LUSTRE/tests/directio} +[ $MDSCOUNT -gt 1 ] && skip "CMD case" && exit 0 remote_mds_nodsh && skip "remote MDS with nodsh" && exit 0 remote_ost_nodsh && skip "remote OST with nodsh" && exit 0