oqaq->qaq_id = id;
oqaq->qaq_flags = type;
- quota_search_lqs(NULL, oqaq, qctxt, &lqs);
- if (lqs) {
+ lqs = quota_search_lqs(LQS_KEY(type, id), qctxt, 0);
+ if (lqs && !IS_ERR(lqs)) {
spin_lock(&lqs->lqs_lock);
oqaq->qaq_bunit_sz = lqs->lqs_bunit_sz;
oqaq->qaq_iunit_sz = lqs->lqs_iunit_sz;
dqacq_adjust_qunit_sz(obd, qdata->qd_id, QDATA_IS_GRP(qdata),
QDATA_IS_BLK(qdata));
- quota_search_lqs(qdata, NULL, qctxt, &lqs);
- if (QDATA_IS_BLK(qdata)) {
- if (!lqs) {
- CDEBUG(D_INFO, "Can't find the lustre qunit size!\n");
- qdata->qd_qunit = qctxt->lqc_bunit_sz;
- } else {
- spin_lock(&lqs->lqs_lock);
- qdata->qd_qunit = lqs->lqs_bunit_sz;
- spin_unlock(&lqs->lqs_lock);
- }
- QDATA_SET_ADJBLK(qdata);
+ lqs = quota_search_lqs(LQS_KEY(QDATA_IS_GRP(qdata), qdata->qd_id),
+ qctxt, 0);
+ if (lqs == NULL || IS_ERR(lqs)) {
+ CDEBUG(D_INFO, "Can't find the lustre qunit size!\n");
+ qdata->qd_qunit = QDATA_IS_BLK(qdata) ? qctxt->lqc_bunit_sz :
+ qctxt->lqc_iunit_sz;
} else {
- if (!lqs) {
- CDEBUG(D_INFO, "Can't find the lustre qunit size!\n");
- qdata->qd_qunit = qctxt->lqc_iunit_sz;
- } else {
- spin_lock(&lqs->lqs_lock);
- qdata->qd_qunit = lqs->lqs_iunit_sz;
- spin_unlock(&lqs->lqs_lock);
- }
- QDATA_SET_ADJINO(qdata);
+ spin_lock(&lqs->lqs_lock);
+ qdata->qd_qunit = QDATA_IS_BLK(qdata) ? lqs->lqs_bunit_sz :
+ lqs->lqs_iunit_sz;
+ spin_unlock(&lqs->lqs_lock);
}
+ if (QDATA_IS_BLK(qdata))
+ QDATA_SET_ADJBLK(qdata);
+ else
+ QDATA_SET_ADJINO(qdata);
+
QDATA_DEBUG(qdata, "alloc/release qunit in dqacq_handler\n");
if (lqs)
lqs_putref(lqs);
RETURN(-EBUSY);
}
+ LASSERT(!obt->obt_qctxt.lqc_immutable);
down(&mds->mds_qonoff_sem);
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
rc = mds_admin_quota_on(obd, oqctl);
struct mds_obd *mds = &obd->u.mds;
struct obd_device_target *obt = &obd->u.obt;
struct lvfs_run_ctxt saved;
- int rc, rc2;
+ int rc, rc2, imm;
ENTRY;
+ imm = oqctl->qc_type & IMMQUOTA;
+ oqctl->qc_type &= ~IMMQUOTA;
+
if (oqctl->qc_type != USRQUOTA &&
oqctl->qc_type != GRPQUOTA &&
oqctl->qc_type != UGQUOTA)
rc = obd_quotactl(mds->mds_osc_exp, oqctl);
rc2 = fsfilt_quotactl(obd, obd->u.obt.obt_sb, oqctl);
- if (!rc2)
+ if (!rc2) {
+ if (imm)
+ obt->obt_qctxt.lqc_immutable = 1;
obt->obt_qctxt.lqc_flags &= ~UGQUOTA2LQC(oqctl->qc_type);
-
+ }
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
up(&mds->mds_qonoff_sem);
atomic_inc(&obt->obt_quotachecking);
/* get block usage from OSS */
soqc->qc_dqblk.dqb_curspace = 0;
rc = obd_quotactl(obd->u.mds.mds_osc_exp, soqc);
- if (!rc) {
+ if (!rc || rc == -EREMOTEIO) {
oqctl->qc_dqblk.dqb_curspace = soqc->qc_dqblk.dqb_curspace;
oqctl->qc_dqblk.dqb_valid |= QIF_SPACE;
}