From a33880683298dc8e2198a85e8d2bd3175978bf2a Mon Sep 17 00:00:00 2001 From: johann <johann> Date: Mon, 8 Sep 2008 22:30:02 +0000 Subject: [PATCH] Branch b1_6 b=16260 i=tianzy i=panda The quota master must return EAGAIN to quota request until the config is processed. --- lustre/include/lustre_quota.h | 6 +++++- lustre/ldlm/ldlm_lib.c | 11 +++++++++++ lustre/mds/mds_lov.c | 4 ++++ lustre/quota/quota_context.c | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index 54ea6e029e..d1d2fa1cbb 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -230,8 +230,12 @@ struct lustre_quota_ctxt { dqacq_handler_t lqc_handler; /* dqacq/dqrel RPC handler, only for quota master */ unsigned long lqc_flags; /* quota flags */ unsigned long lqc_recovery:1, /* Doing recovery */ - lqc_switch_qs:1; /* the function of change qunit size + lqc_switch_qs:1, /* the function of change qunit size * 0:Off, 1:On */ + lqc_setup:1; /* tell whether of not quota_type has + * been processed, so that the master + * knows when it can start processing + * incoming acq/rel quota requests */ unsigned long lqc_iunit_sz; /* original unit size of file quota and * upper limitation for adjust file * qunit */ diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index ecad95f7fa..a9bb6b5eeb 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1787,6 +1787,17 @@ int target_handle_dqacq_callback(struct ptlrpc_request *req) master_obd = obd->obd_observer->obd_observer; qctxt = &master_obd->u.obt.obt_qctxt; + if (!qctxt->lqc_setup) { + /* quota_type has not been processed yet, return EAGAIN + * until we know whether or not quotas are supposed to + * be enabled */ + CDEBUG(D_QUOTA, "quota_type not processed yet, return " + "-EAGAIN\n"); + req->rq_status = -EAGAIN; + rc = ptlrpc_reply(req); + GOTO(out, rc); + } + LASSERT(qctxt->lqc_handler); rc = qctxt->lqc_handler(master_obd, qdata, lustre_msg_get_opc(req->rq_reqmsg)); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index f9b677049f..7f47814ed3 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -1054,6 +1054,10 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched, break; case OBD_NOTIFY_CONFIG: mds_allow_cli(obd, (unsigned long)data); + + /* quota_type has been processed, we can now handle + * incoming quota requests */ + obd->u.obt.obt_qctxt.lqc_setup = 1; default: RETURN(0); } diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 629f9c8b96..71c3dc5dd8 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -1072,6 +1072,7 @@ qctxt_init(struct obd_device *obd, dqacq_handler_t handler) qctxt->lqc_cqs_least_iunit = 2; qctxt->lqc_cqs_qs_factor = 2; qctxt->lqc_flags = 0; + qctxt->lqc_setup = 0; qctxt->lqc_bunit_sz = default_bunit_sz; qctxt->lqc_btune_sz = default_bunit_sz / 100 * default_btune_ratio; qctxt->lqc_iunit_sz = default_iunit_sz; -- GitLab