/* turn on cluster wide quota */
rc1 = mds_admin_quota_on(obd, oqctl);
if (rc1 && rc1 != -EALREADY) {
- CDEBUG(rc1 == -ENOENT ? D_QUOTA : D_ERROR,
- "auto-enable admin quota failed. rc=%d\n", rc1);
+ CDEBUG_LIMIT(rc1 == -ENOENT ? D_QUOTA : D_ERROR,
+ "%s: auto-enable admin quota failed with "
+ "rc=%d\n", obd->obd_name, rc1);
GOTO(out_ctxt, rc1);
}
}
obd->obd_name, oqctl->qc_type);
rc = -EALREADY;
} else {
- CDEBUG(rc == -ENOENT ? D_QUOTA : D_ERROR,
- "auto-enable local quota failed. rc=%d\n", rc);
+ CDEBUG_LIMIT(rc == -ENOENT ? D_QUOTA : D_ERROR,
+ "%s: auto-enable local quota failed with rc=%d\n",
+ obd->obd_name, rc);
if (rc1 == -EALREADY) {
oqctl->qc_cmd = Q_QUOTAOFF;
mds_admin_quota_off(obd, oqctl);
lprocfs_quota_common_vars, obd);
if (IS_ERR(qctxt->lqc_proc_dir)) {
rc = PTR_ERR(qctxt->lqc_proc_dir);
- CERROR("error %d setting up lprocfs for %s\n", rc,
- obd->obd_name);
+ CERROR("%s: error %d setting up lprocfs\n",
+ obd->obd_name, rc);
qctxt->lqc_proc_dir = NULL;
GOTO(out, rc);
}
rc = lprocfs_add_vars(qctxt->lqc_proc_dir,
lprocfs_quota_master_vars, obd);
if (rc) {
- CERROR("error %d setting up lprocfs for %s"
- "(quota master)\n", rc, obd->obd_name);
+ CERROR("%s: error %d setting up lprocfs for "
+ "quota master\n", obd->obd_name, rc);
GOTO(out_free_proc, rc);
}
}
if (rc == 0) {
return lqs;
} else {
- CDEBUG(D_ERROR, "get lqs error(rc: %d)\n", rc);
+ CERROR("get lqs error(rc: %d)\n", rc);
return ERR_PTR(rc);
}
}
lqs = quota_search_lqs(LQS_KEY(QAQ_IS_GRP(oqaq), oqaq->qaq_id),
qctxt, QAQ_IS_CREATE_LQS(oqaq) ? 1 : 0);
if (lqs == NULL || IS_ERR(lqs)){
- CDEBUG(D_ERROR, "fail to find a lqs(%s id: %u)!\n",
- QAQ_IS_GRP(oqaq) ? "group" : "user", oqaq->qaq_id);
+ CERROR("fail to find a lqs for %sid %u!\n",
+ QAQ_IS_GRP(oqaq) ? "g" : "u", oqaq->qaq_id);
RETURN(PTR_ERR(lqs));
}
lqs = quota_search_lqs(LQS_KEY(QDATA_IS_GRP(qdata), qdata->qd_id),
qctxt, 0);
if (IS_ERR(lqs) || lqs == NULL) {
- CDEBUG(D_ERROR, "fail to find a lqs(%s id: %u)!\n",
- QDATA_IS_GRP(qdata) ? "group" : "user", qdata->qd_id);
+ CERROR("fail to find a lqs for %sid: %u)!\n",
+ QDATA_IS_GRP(qdata) ? "g" : "u", qdata->qd_id);
GOTO (out, ret = 0);
}
spin_lock(&lqs->lqs_lock);
OBD_SLAB_ALLOC(qunit, qunit_cachep, CFS_ALLOC_IO, sizeof(*qunit));
if (qunit == NULL) {
- CERROR("locating qunit failed.(id=%u isblk=%d %s)\n",
- oqctl->qc_id, isblk, oqctl->qc_type ? "grp" : "usr");
+ CERROR("locating %sunit failed for %sid %u\n",
+ isblk ? "b" : "i", oqctl->qc_type ? "g" : "u",
+ oqctl->qc_id);
qctxt_wait_pending_dqacq(qctxt, oqctl->qc_id,
oqctl->qc_type, isblk);
return NULL;
if (qdata->qd_id != qunit->lq_data.qd_id ||
OBD_FAIL_CHECK(OBD_FAIL_QUOTA_RET_QDATA)) {
- CDEBUG(D_ERROR, "the returned qd_id isn't expected!"
+ CERROR("the returned qd_id isn't expected!"
"(qdata: %u, lq_data: %u)\n", qdata->qd_id,
qunit->lq_data.qd_id);
qdata->qd_id = qunit->lq_data.qd_id;
rc = -EPROTO;
}
if (QDATA_IS_GRP(qdata) != QDATA_IS_GRP(&qunit->lq_data)) {
- CDEBUG(D_ERROR, "the returned grp/usr isn't expected!"
+ CERROR("the returned grp/usr isn't expected!"
"(qdata: %u, lq_data: %u)\n", qdata->qd_flags,
qunit->lq_data.qd_flags);
if (QDATA_IS_GRP(&qunit->lq_data))
rc = -EPROTO;
}
if (qdata->qd_count > qunit->lq_data.qd_count) {
- CDEBUG(D_ERROR, "the returned qd_count isn't expected!"
+ CERROR("the returned qd_count isn't expected!"
"(qdata: "LPU64", lq_data: "LPU64")\n", qdata->qd_count,
qunit->lq_data.qd_count);
rc = -EPROTO;
/* this is for quota_search_lqs */
lqs_putref(lqs);
} else {
- CDEBUG(D_ERROR, "Can't find the lustre qunit size!\n");
+ CERROR("Can't find the lustre qunit size!\n");
}
QDATA_DEBUG(qdata, "obd(%s): send %s quota req\n",
LUSTRE_MDS_VERSION, opc);
class_import_put(imp);
if (req == NULL) {
- CDEBUG(D_ERROR, "Can't alloc request\n");
+ CERROR("Can't alloc request\n");
dqacq_completion(obd, qctxt, qdata, -ENOMEM, opc);
/* this is for qunit_get() */
qunit_put(qunit);
req->rq_no_resend = req->rq_no_delay = 1;
rc = quota_copy_qdata(req, qdata, QUOTA_REQUEST, QUOTA_IMPORT);
if (rc < 0) {
- CDEBUG(D_ERROR, "Can't pack qunit_data(rc: %d)\n", rc);
+ CERROR("Can't pack qunit_data(rc: %d)\n", rc);
ptlrpc_req_finished(req);
dqacq_completion(obd, qctxt, qdata, -EPROTO, opc);
/* this is for qunit_get() */
rc = 0;
}
- if (rc)
- CDEBUG(rc == -EBUSY ? D_QUOTA : D_ERROR,
- "qslave recovery failed! (id:%d type:%d "
+ if (rc && rc != -EBUSY)
+ CERROR("qslave recovery failed! (id:%d type:%d "
" rc:%d)\n", dqid->di_id, type, rc);
free:
OBD_FREE_PTR(dqid);
i, &id_list);
#endif
if (rc) {
- CDEBUG(D_ERROR, "fail to get %s qids!\n",
+ CERROR("%s: failed to get %s qids!\n", obd->obd_name,
i ? "group" : "user");
continue;
}
lqs->lqs_flags |= dqid->di_flag;
lqs_putref(lqs);
} else {
- CDEBUG(D_ERROR, "fail to create a lqs"
- "(%s id: %u)!\n", i ? "group" : "user",
+ CERROR("%s: failed to create a lqs for %sid %u"
+ "\n", obd->obd_name, i ? "g" : "u",
dqid->di_id);
}
lqs = quota_search_lqs(LQS_KEY(oqctl->qc_type, oqctl->qc_id),
qctxt, 0);
if (lqs == NULL || IS_ERR(lqs)){
- CDEBUG(D_ERROR, "fail to create lqs when setquota\n");
+ CERROR("fail to create lqs during setquota operation "
+ "for %sid %u\n", oqctl->qc_type ? "g" : "u",
+ oqctl->qc_id);
} else {
lqs->lqs_flags &= ~QB_SET;
lqs_putref(lqs);
lqs = quota_search_lqs(LQS_KEY(oqctl->qc_type, oqctl->qc_id),
qctxt, 1);
if (lqs == NULL || IS_ERR(lqs)){
- CDEBUG(D_ERROR, "fail to create lqs when setquota\n");
+ CERROR("fail to create lqs during setquota operation "
+ "for %sid %u\n", oqctl->qc_type ? "g" : "u",
+ oqctl->qc_id);
break;
} else {
lqs->lqs_flags |= QB_SET;
CDEBUG(D_WARNING, "%s: lqc_import(%p) of obd(%p) was "
"activated already.\n", obd->obd_name, imp, obd);
else
- CDEBUG(D_ERROR, "%s: lqc_import(%p:%p) of obd(%p) was "
+ CERROR("%s: lqc_import(%p:%p) of obd(%p) was "
"activated by others.\n", obd->obd_name,
qctxt->lqc_import, imp, obd);
} else {
RETURN(0);
OBD_ALLOC_PTR(oqctl);
- if (!oqctl) {
- CERROR("Not enough memory!");
+ if (!oqctl)
RETURN(-ENOMEM);
- }
/* set over quota flags for a uid/gid */
oa->o_valid |= OBD_MD_FLUSRQUOTA | OBD_MD_FLGRPQUOTA;
rc = fsfilt_get_mblk(obd, qctxt->lqc_sb,
&mb, inode,frags);
if (rc)
- CDEBUG(D_ERROR,
- "can't get extra "
- "meta blocks.\n");
+ CERROR("%s: can't get extra "
+ "meta blocks\n",
+ obd->obd_name);
else
pending[i] += mb;
}
sema_init(&mds->mds_qonoff_sem, 1);
rc = qctxt_init(obd, dqacq_handler);
if (rc) {
- CERROR("initialize quota context failed! (rc:%d)\n", rc);
+ CERROR("%s: initialize quota context failed! (rc:%d)\n",
+ obd->obd_name, rc);
RETURN(rc);
}
mds->mds_quota = 1;
(flags & OBD_FL_NO_USRQUOTA) : (flags & OBD_FL_NO_GRPQUOTA);
oqi = alloc_qinfo(cli, id, cnt);
- if (oqi) {
- spin_lock(&qinfo_list_lock);
-
- old = find_qinfo(cli, id, cnt);
- if (old && !noquota)
- remove_qinfo_hash(old);
- else if (!old && noquota)
- insert_qinfo_hash(oqi);
-
- spin_unlock(&qinfo_list_lock);
-
- if (old || !noquota)
- free_qinfo(oqi);
- if (old && !noquota)
- free_qinfo(old);
- } else {
- CERROR("not enough mem!\n");
+ if (!oqi) {
rc = -ENOMEM;
break;
}
+
+ spin_lock(&qinfo_list_lock);
+ old = find_qinfo(cli, id, cnt);
+ if (old && !noquota)
+ remove_qinfo_hash(old);
+ else if (!old && noquota)
+ insert_qinfo_hash(oqi);
+ spin_unlock(&qinfo_list_lock);
+
+ if (old || !noquota)
+ free_qinfo(oqi);
+ if (old && !noquota)
+ free_qinfo(old);
}
RETURN(rc);
LQUOTA_FLAGS_ADJINO, oqaq);
if (rc < 0) {
- CDEBUG(D_ERROR, "create oqaq failed! (rc:%d)\n", rc);
+ CERROR("create oqaq failed! (rc:%d)\n", rc);
GOTO(out_sem, rc);
}
QAQ_DEBUG(oqaq, "show oqaq.\n")
if (adjust_res <= 0) {
if (adjust_res < 0) {
rc = adjust_res;
- CDEBUG(D_ERROR, "adjust mds slave's qunit size failed! \
- (rc:%d)\n", rc);
+ CERROR("adjust mds slave's qunit size failed! "
+ "(rc:%d)\n", rc);
} else {
CDEBUG(D_QUOTA, "qunit doesn't need to be adjusted.\n");
}
rc = 0;
}
if (rc) {
- CDEBUG(D_ERROR, "mds fail to adjust file quota! \
- (rc:%d)\n", rc);
+ CERROR("%s: mds fail to adjust file quota! (rc:%d)\n",
+ obd->obd_name, rc);
GOTO(out, rc);
}
fp = filp_open(name, O_CREAT | O_TRUNC | O_RDWR, 0644);
if (IS_ERR(fp)) {
rc = PTR_ERR(fp);
- CERROR("error invalidating admin quotafile %s (rc:%d)\n",
- name, rc);
+ CERROR("%s: error invalidating admin quotafile %s (rc:%d)\n",
+ obd->obd_name, name, rc);
}
else
filp_close(fp, 0);
/* -EINVAL may be returned by quotainfo for bad quota file */
if (rc != -ENOENT && rc != -EINVAL) {
- CERROR("error opening old quota file %s (%d)\n",
- name, rc);
+ CERROR("%s: error opening old quota file %s (%d)\n",
+ obd->obd_name, name, rc);
break;
}
fp = filp_open(name, O_CREAT | O_TRUNC | O_RDWR, 0644);
if (IS_ERR(fp)) {
rc = PTR_ERR(fp);
- CERROR("error creating admin quotafile %s (rc:%d)\n",
- name, rc);
+ CERROR("%s: error creating admin quotafile %s (rc:%d)\n",
+ obd->obd_name, name, rc);
break;
}
rc = dquot_recovery(obd, dqid->di_id, type);
if (rc)
- CERROR("qmaster recovery failed! (id:%d type:%d"
- " rc:%d)\n", dqid->di_id, type, rc);
+ CERROR("%s: qmaster recovery failed for %sid %d"
+ " rc:%d)\n", obd->obd_name,
+ type ? "g" : "u", dqid->di_id, rc);
free:
OBD_FREE_PTR(dqid);
}
rc = kernel_thread(qmaster_recovery_main, &data, CLONE_VM|CLONE_FILES);
if (rc < 0)
- CERROR("Cannot start quota recovery thread: rc %d\n", rc);
+ CERROR("%s: cannot start quota recovery thread: rc %d\n",
+ obd->obd_name, rc);
wait_for_completion(&data.comp);
RETURN(rc);