down(&mds->mds_qonoff_sem);
/* turn on cluster wide quota */
rc = mds_admin_quota_on(obd, oqctl);
- if (rc)
- CDEBUG(rc == -ENOENT ? D_QUOTA : D_ERROR,
- "auto-enable admin quota failed. rc=%d\n", rc);
+ if (rc && rc != -ENOENT)
+ CERROR("%s: auto-enable admin quota failed. rc=%d\n",
+ obd->obd_name, rc);
up(&mds->mds_qonoff_sem);
}
if (!rc) {
/* turn on local quota */
rc = fsfilt_quotactl(obd, sb, oqctl);
- if (rc)
- CDEBUG(rc == -ENOENT ? D_QUOTA : D_ERROR,
- "auto-enable local quota failed. rc=%d\n", rc);
- else
+ if (rc) {
+ if (rc != -ENOENT)
+ CERROR("%s: auto-enable local quota failed with"
+ " rc=%d\n", obd->obd_name, rc);
+ } else {
obt->obt_qctxt.lqc_flags |= UGQUOTA2LQC(type);
+ }
}
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
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_ONCE(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",
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);
dqacq_completion(obd, qctxt, qdata, rc, opc);
class_import_put(imp);
/* this is for qunit_get() */
HASH_LQS_MAX_BITS,
&lqs_hash_ops, 0);
if (!qctxt->lqc_lqs_hash)
- CERROR("initialize hash lqs for %s error!\n", obd->obd_name);
+ CERROR("%s: initialize hash lqs failed\n", obd->obd_name);
#ifdef LPROCFS
if (lquota_proc_setup(obd, is_master(obd, qctxt, 0, 0)))
- CERROR("initialize proc for %s error!\n", obd->obd_name);
+ CERROR("%s: initialize proc failed\n", obd->obd_name);
#endif
RETURN(rc);
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;
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;
LASSERT(inode && frags > 0);
if (fsfilt_get_mblk(obd, qctxt->lqc_sb, &mb,
inode, frags) < 0)
- 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;
lqs->lqs_bwrite_pending += pending[i];
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);
}
RETURN(rc);
(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);
if (!IS_ERR(fp)) {
/* irregular file is not the right place for quota */
if (!S_ISREG(fp->f_dentry->d_inode->i_mode)) {
- CERROR("admin quota file %s is not "
- "regular!", quotafile);
+ CERROR("%s: admin quota file %s is not "
+ "regular!", obd->obd_name, quotafile);
filp_close(fp, 0);
rc = -EINVAL;
break;
/* -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;
}
case LUSTRE_QUOTA_V1:
rc = fsfilt_quotainfo(obd, qinfo, i, QFILE_INIT_INFO);
if (rc)
- CERROR("error init %s admin quotafile! (rc:%d)\n",
+ CERROR("%s: error init %s admin quotafile! "
+ "(rc:%d)\n", obd->obd_name,
i == USRQUOTA ? "user" : "group", rc);
break;
case LUSTRE_QUOTA_V2:
rc = fsfilt_quotainfo(obd, qinfo, i, QFILE_CONVERT);
if (rc)
- CERROR("error convert %s admin quotafile! (rc:%d)\n",
+ CERROR("%s: error convert %s admin quotafile! "
+ "(rc:%d)\n", obd->obd_name,
i == USRQUOTA ? "user" : "group", rc);
break;
default:
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);