From 39cdd8f0bc06eb85f96ee064b48737933d3b4445 Mon Sep 17 00:00:00 2001 From: tianzy Date: Mon, 8 Jun 2009 08:01:44 +0000 Subject: [PATCH] Branch b_release_1_8_1 fix MDS lockup during inode quota test b=19672 i=johann i=yong.fan --- lustre/quota/quota_context.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 75ecede..3fddfdc 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -869,7 +869,7 @@ void dqacq_interrupt(struct lustre_quota_ctxt *qctxt) EXIT; } -static int got_qunit(struct lustre_qunit *qunit) +static int got_qunit(struct lustre_qunit *qunit, int is_master) { struct lustre_quota_ctxt *qctxt = qunit->lq_ctxt; int rc = 0; @@ -890,7 +890,9 @@ static int got_qunit(struct lustre_qunit *qunit) if (!rc) { spin_lock(&qctxt->lqc_lock); - rc = !qctxt->lqc_import || !qctxt->lqc_valid; + rc = !qctxt->lqc_valid; + if (!is_master) + rc |= !qctxt->lqc_import; spin_unlock(&qctxt->lqc_lock); } @@ -912,6 +914,7 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt, struct timeval work_start; struct timeval work_end; long timediff; + int ismaster = is_master(obd, qctxt, qdata->qd_id, QDATA_IS_GRP(qdata)); int rc = 0; ENTRY; @@ -950,7 +953,7 @@ schedule_dqacq(struct obd_device *obd, struct lustre_quota_ctxt *qctxt, QDATA_DEBUG(qdata, "obd(%s): send %s quota req\n", obd->obd_name, (opc == QUOTA_DQACQ) ? "acq" : "rel"); /* master is going to dqacq/dqrel from itself */ - if (is_master(obd, qctxt, qdata->qd_id, QDATA_IS_GRP(qdata))) { + if (ismaster) { int rc2; QDATA_DEBUG(qdata, "local %s.\n", opc == QUOTA_DQACQ ? "DQACQ" : "DQREL"); @@ -1057,7 +1060,7 @@ wait_completion: struct qunit_data *p = &qunit->lq_data; QDATA_DEBUG(p, "qunit(%p) is waiting for dqacq.\n", qunit); - l_wait_event(qunit->lq_waitq, got_qunit(qunit), &lwi); + l_wait_event(qunit->lq_waitq, got_qunit(qunit, ismaster), &lwi); /* rc = -EAGAIN, it means the quota master isn't ready yet * rc = QUOTA_REQ_RETURNED, it means a quota req is finished; * rc = -EDQUOT, it means out of quota @@ -1137,6 +1140,7 @@ qctxt_wait_pending_dqacq(struct lustre_quota_ctxt *qctxt, unsigned int id, struct timeval work_end; long timediff; struct l_wait_info lwi = { 0 }; + int ismaster = is_master(NULL, qctxt, id, type); int rc = 0; ENTRY; @@ -1155,7 +1159,7 @@ qctxt_wait_pending_dqacq(struct lustre_quota_ctxt *qctxt, unsigned int id, struct qunit_data *p = &qunit->lq_data; QDATA_DEBUG(p, "qunit(%p) is waiting for dqacq.\n", qunit); - l_wait_event(qunit->lq_waitq, got_qunit(qunit), &lwi); + l_wait_event(qunit->lq_waitq, got_qunit(qunit, ismaster), &lwi); CDEBUG(D_QUOTA, "qunit(%p) finishes waiting. (rc:%d)\n", qunit, qunit->lq_rc); /* keep same as schedule_dqacq() b=17030 */ -- 1.8.3.1