From 76a63f95f8516edb2a7d7af797299078f37efd50 Mon Sep 17 00:00:00 2001 From: tianzy Date: Tue, 3 Feb 2009 06:45:38 +0000 Subject: [PATCH] Branch HEAD use QUOTA_REQ_RETURNED to replace -EAGAIN when a quota req is finished. b=18307 i=johann i=panda --- lustre/ptlrpc/pack_generic.c | 5 +++-- lustre/quota/quota_adjust_qunit.c | 3 ++- lustre/quota/quota_context.c | 19 ++++++++----------- lustre/quota/quota_interface.c | 2 +- lustre/quota/quota_internal.h | 2 ++ lustre/quota/quota_master.c | 11 ++++++----- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index fffc9de..e85951a 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -389,8 +389,9 @@ void *lustre_msg_buf_v2(struct lustre_msg_v2 *m, int n, int min_size) buflen = m->lm_buflens[n]; if (unlikely(buflen < min_size)) { - CERROR("msg %p buffer[%d] size %d too small (required %d)\n", - m, n, buflen, min_size); + CERROR("msg %p buffer[%d] size %d too small " + "(required %d, opc=%d)\n", + m, n, buflen, min_size, lustre_msg_get_opc(m)); return NULL; } diff --git a/lustre/quota/quota_adjust_qunit.c b/lustre/quota/quota_adjust_qunit.c index df2115d..abe57dd 100644 --- a/lustre/quota/quota_adjust_qunit.c +++ b/lustre/quota/quota_adjust_qunit.c @@ -331,7 +331,8 @@ int filter_quota_adjust_qunit(struct obd_export *exp, if (rc > 0) { rc = qctxt_adjust_qunit(obd, qctxt, uid, gid, 1, 0, NULL); - if (rc == -EDQUOT || rc == -EBUSY || rc == -EAGAIN) { + if (rc == -EDQUOT || rc == -EBUSY || + rc == QUOTA_REQ_RETURNED || rc == -EAGAIN) { CDEBUG(D_QUOTA, "rc: %d.\n", rc); rc = 0; } diff --git a/lustre/quota/quota_context.c b/lustre/quota/quota_context.c index 917a162..162f0af 100644 --- a/lustre/quota/quota_context.c +++ b/lustre/quota/quota_context.c @@ -636,8 +636,10 @@ out: compute_lqs_after_removing_qunit(qunit); - /* wake up all waiters */ + if (rc == 0) + rc = QUOTA_REQ_RETURNED; QUNIT_SET_STATE_AND_RC(qunit, QUNIT_FINISHED, rc); + /* wake up all waiters */ wake_up_all(&qunit->lq_waitq); /* this is for dqacq_in_flight() */ @@ -664,7 +666,7 @@ out: CERROR("adjust slave's qunit size failed!(rc:%d)\n", rc1); RETURN(rc1); } - if (err || (rc && rc != -EBUSY && rc1 == 0) || is_master(qctxt)) + if (err || (rc < 0 && rc != -EBUSY && rc1 == 0) || is_master(qctxt)) RETURN(err); /* reschedule another dqacq/dqrel if needed */ @@ -983,16 +985,14 @@ wait_completion: QDATA_DEBUG(p, "qunit(%p) is waiting for dqacq.\n", qunit); l_wait_event(qunit->lq_waitq, got_qunit(qunit), &lwi); - /* rc = -EAGAIN, it means a quota req is finished; + /* 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 * rc = -EBUSY, it means recovery is happening * other rc < 0, it means real errors, functions who call * schedule_dqacq should take care of this */ spin_lock(&qunit->lq_lock); - if (qunit->lq_rc == 0) - rc = -EAGAIN; - else - rc = qunit->lq_rc; + rc = qunit->lq_rc; spin_unlock(&qunit->lq_lock); CDEBUG(D_QUOTA, "qunit(%p) finishes waiting. (rc:%d)\n", qunit, rc); @@ -1088,10 +1088,7 @@ qctxt_wait_pending_dqacq(struct lustre_quota_ctxt *qctxt, unsigned int id, qunit, qunit->lq_rc); /* keep same as schedule_dqacq() b=17030 */ spin_lock(&qunit->lq_lock); - if (qunit->lq_rc == 0) - rc = -EAGAIN; - else - rc = qunit->lq_rc; + rc = qunit->lq_rc; spin_unlock(&qunit->lq_lock); /* this is for dqacq_in_flight() */ qunit_put(qunit); diff --git a/lustre/quota/quota_interface.c b/lustre/quota/quota_interface.c index 87ee09a..2ef1b67 100644 --- a/lustre/quota/quota_interface.c +++ b/lustre/quota/quota_interface.c @@ -381,7 +381,7 @@ static int quota_chk_acq_common(struct obd_device *obd, unsigned int uid, /* please reference to dqacq_completion for the below */ /* a new request is finished, try again */ - if (rc == -EAGAIN) { + if (rc == QUOTA_REQ_RETURNED) { CDEBUG(D_QUOTA, "finish a quota req, try again\n"); continue; } diff --git a/lustre/quota/quota_internal.h b/lustre/quota/quota_internal.h index 457da1a..8856af3 100644 --- a/lustre/quota/quota_internal.h +++ b/lustre/quota/quota_internal.h @@ -187,6 +187,8 @@ extern cfs_proc_dir_entry_t *lquota_type_proc_dir; #define LQS_INO_DECREASE 4 #define LQS_INO_INCREASE 8 +/* the return status of quota operation */ +#define QUOTA_REQ_RETURNED 1 #endif int client_quota_adjust_qunit(struct obd_export *exp, diff --git a/lustre/quota/quota_master.c b/lustre/quota/quota_master.c index 9629357..62b7127 100644 --- a/lustre/quota/quota_master.c +++ b/lustre/quota/quota_master.c @@ -552,8 +552,9 @@ int mds_quota_adjust(struct obd_device *obd, unsigned int qcids[], } if (rc2) - CDEBUG(rc2 == -EAGAIN ? D_QUOTA: D_ERROR, - "mds adjust qunit failed! (opc:%d rc:%d)\n", opc, rc2); + CDEBUG(rc2 == QUOTA_REQ_RETURNED ? D_QUOTA: D_ERROR, + "mds adjust qunit %ssuccessfully! (opc:%d rc:%d)\n", + rc2 == QUOTA_REQ_RETURNED ? "" : "un", opc, rc2); RETURN(0); } @@ -590,9 +591,9 @@ int filter_quota_adjust(struct obd_device *obd, unsigned int qcids[], if (rc || rc2) { if (!rc) rc = rc2; - CDEBUG(rc == -EAGAIN ? D_QUOTA: D_ERROR, - "filter adjust qunit failed! (opc:%d rc%d)\n", - opc, rc); + CDEBUG(rc == QUOTA_REQ_RETURNED ? D_QUOTA: D_ERROR, + "filter adjust qunit %ssuccessfully! (opc:%d rc%d)\n", + QUOTA_REQ_RETURNED ? "" : "un", opc, rc); } RETURN(0); -- 1.8.3.1