init_rwsem(&obt->obt_rwsem);
obt->obt_qfmt = LUSTRE_QUOTA_V2;
- atomic_set(&obt->obt_quotachecking, 1);
+ sema_init(&obt->obt_quotachecking, 1);
rc = qctxt_init(obd, NULL);
if (rc)
CERROR("initialize quota context failed! (rc:%d)\n", rc);
int rc = 0, rc2[2] = { 0, 0 };
ENTRY;
- CLASSERT(MAXQUOTAS < 4);
- if (!sb_any_quota_enabled(qctxt->lqc_sb))
- RETURN(rc);
-
spin_lock(&qctxt->lqc_lock);
if (!qctxt->lqc_valid){
spin_unlock(&qctxt->lqc_lock);
RETURN(rc);
}
+int quota_is_set(struct obd_device *obd, const unsigned int id[], int flag)
+{
+ struct lustre_qunit_size *lqs;
+ int i, q_set = 0;
+
+ if (!sb_any_quota_enabled(obd->u.obt.obt_qctxt.lqc_sb))
+ RETURN(0);
+
+ for (i = 0; i < MAXQUOTAS; i++) {
+ lqs = quota_search_lqs(LQS_KEY(i, id[i]),
+ &obd->u.obt.obt_qctxt, 0);
+ if (lqs && !IS_ERR(lqs)) {
+ if (lqs->lqs_flags & flag)
+ q_set = 1;
+ lqs_putref(lqs);
+ }
+ }
+
+ return q_set;
+}
+
static int quota_chk_acq_common(struct obd_device *obd, const unsigned int id[],
int pending[], int count, quota_acquire acquire,
struct obd_trans_info *oti, int isblk,
int rc = 0, cycle = 0, count_err = 1;
ENTRY;
+ if (!quota_is_set(obd, id, isblk ? QB_SET : QI_SET))
+ RETURN(0);
+
CDEBUG(D_QUOTA, "check quota for %s\n", obd->obd_name);
pending[USRQUOTA] = pending[GRPQUOTA] = 0;
/* Unfortunately, if quota master is too busy to handle the
break;
}
+ /* Related quota has been disabled by master, but enabled by
+ * slave, do not try again. */
+ if (unlikely(rc == -ESRCH)) {
+ CERROR("mismatched quota configuration, stop try.\n");
+ break;
+ }
+
/* -EBUSY and others, wait a second and try again */
if (rc < 0) {
cfs_waitq_t waitq;
l_wait_event(waitq, 0, &lwi);
}
- if (rc < 0 || cycle % 10 == 2) {
+ if (rc < 0 || cycle % 10 == 0) {
spin_lock(&last_print_lock);
if (last_print == 0 ||
cfs_time_before((last_print + cfs_time_seconds(30)),
init_rwsem(&obt->obt_rwsem);
obt->obt_qfmt = LUSTRE_QUOTA_V2;
mds->mds_quota_info.qi_version = LUSTRE_QUOTA_V2;
- atomic_set(&obt->obt_quotachecking, 1);
+ sema_init(&obt->obt_quotachecking, 1);
/* initialize quota master and quota context */
sema_init(&mds->mds_qonoff_sem, 1);
rc = qctxt_init(obd, dqacq_handler);