Address some cleanups that were mentioned during code inspection.
Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
Change-Id: I3cab9c0e6bfefef0d717e542f6620cc167075937
Reviewed-on: http://review.whamcloud.com/4855
Tested-by: Hudson
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
if (result > 0)
/* end of directory */
dp->ldp_hash_end = cpu_to_le64(MDS_DIR_END_OFF);
if (result > 0)
/* end of directory */
dp->ldp_hash_end = cpu_to_le64(MDS_DIR_END_OFF);
CWARN("build page failed: %d!\n", result);
return result;
}
CWARN("build page failed: %d!\n", result);
return result;
}
/* and one less inode for the current id */
qi->lqi_id.qid_uid = orig_id;;
qi->lqi_space = -1;
/* and one less inode for the current id */
qi->lqi_id.qid_uid = orig_id;;
qi->lqi_space = -1;
+ /* can't get EDQUOT when reducing usage */
rc = qsd_op_begin(env, qsd, trans, qi, NULL);
rc = qsd_op_begin(env, qsd, trans, qi, NULL);
- if (rc == -EDQUOT || rc == -EINPROGRESS)
+ if (rc == -EINPROGRESS)
rc = 0;
if (rc)
return rc;
rc = 0;
if (rc)
return rc;
qi->lqi_id.qid_uid = orig_id;
qi->lqi_space = -bspace;
rc = qsd_op_begin(env, qsd, trans, qi, NULL);
qi->lqi_id.qid_uid = orig_id;
qi->lqi_space = -bspace;
rc = qsd_op_begin(env, qsd, trans, qi, NULL);
- if (rc == -EDQUOT || rc == -EINPROGRESS)
+ /* can't get EDQUOT when reducing usage */
+ if (rc == -EINPROGRESS)
struct osd_device *osd = osd_obj2dev(obj);
struct osd_thandle *oh;
uint64_t zapid;
struct osd_device *osd = osd_obj2dev(obj);
struct osd_thandle *oh;
uint64_t zapid;
__osd_xattr_declare_set(env, obj, sizeof(struct lustre_mdt_attrs),
XATTR_NAME_LMA, oh);
__osd_xattr_declare_set(env, obj, sizeof(struct lustre_mdt_attrs),
XATTR_NAME_LMA, oh);
- RETURN(osd_declare_quota(env, osd, attr->la_uid, attr->la_gid, 1, oh,
- false, NULL, false));
+ rc = osd_declare_quota(env, osd, attr->la_uid, attr->la_gid, 1, oh,
+ false, NULL, false);
+ RETURN(rc);
}
int __osd_attr_init(const struct lu_env *env, udmu_objset_t *uos,
}
int __osd_attr_init(const struct lu_env *env, udmu_objset_t *uos,
- OBD_ALLOC(name, sizeof("0x00000000-"));
+ OBD_ALLOC(name, LQUOTA_NAME_MAX);
if (name == NULL)
RETURN(-ENOMEM);
if (name == NULL)
RETURN(-ENOMEM);
iops = &parent->do_index_ops->dio_it;
it = iops->init(env, parent, 0, BYPASS_CAPA);
if (IS_ERR(it)) {
iops = &parent->do_index_ops->dio_it;
it = iops->init(env, parent, 0, BYPASS_CAPA);
if (IS_ERR(it)) {
- OBD_FREE(name, sizeof("0x00000000-"));
+ OBD_FREE(name, LQUOTA_NAME_MAX);
iops->put(env, it);
iops->fini(env, it);
iops->put(env, it);
iops->fini(env, it);
- OBD_FREE(name, sizeof("0x00000000-"));
+ OBD_FREE(name, LQUOTA_NAME_MAX);
if (rc > 0)
rc = 0;
RETURN(rc);
if (rc > 0)
rc = 0;
RETURN(rc);
lu_context_key_degister(&lquota_thread_key);
}
lu_context_key_degister(&lquota_thread_key);
}
-MODULE_AUTHOR("Intel, Inc. <http://www.intel.com/>");
+MODULE_AUTHOR("Intel Corporation <http://www.intel.com/>");
MODULE_DESCRIPTION("Lustre Quota");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Lustre Quota");
MODULE_LICENSE("GPL");
struct obd_uuid *uuid;
struct lquota_lvb *lvb;
struct ldlm_resource *res = (*lockp)->l_resource;
struct obd_uuid *uuid;
struct lquota_lvb *lvb;
struct ldlm_resource *res = (*lockp)->l_resource;
ENTRY;
req_capsule_extend(&req->rq_pill, &RQF_LDLM_INTENT_QUOTA);
ENTRY;
req_capsule_extend(&req->rq_pill, &RQF_LDLM_INTENT_QUOTA);
/* on success, pack lvb in reply */
lvb = req_capsule_server_get(&req->rq_pill, &RMF_DLM_LVB);
/* on success, pack lvb in reply */
lvb = req_capsule_server_get(&req->rq_pill, &RMF_DLM_LVB);
- ldlm_lvbo_fill(*lockp, lvb, ldlm_lvbo_size(*lockp));
+ lvb_len = ldlm_lvbo_size(*lockp);
+ lvb_len = ldlm_lvbo_fill(*lockp, lvb, lvb_len);
+ req_capsule_shrink(&req->rq_pill, &RMF_DLM_LVB, lvb_len, RCL_SERVER);
thread_set_flags(&qqi->qqi_reint_thread, SVC_STOPPED);
CFS_INIT_LIST_HEAD(&qqi->qqi_deferred_glb);
CFS_INIT_LIST_HEAD(&qqi->qqi_deferred_slv);
thread_set_flags(&qqi->qqi_reint_thread, SVC_STOPPED);
CFS_INIT_LIST_HEAD(&qqi->qqi_deferred_glb);
CFS_INIT_LIST_HEAD(&qqi->qqi_deferred_slv);
- memset(&qqi->qqi_lockh, 0, sizeof(qqi->qqi_lockh));
/* open accounting object */
LASSERT(qqi->qqi_acct_obj == NULL);
/* open accounting object */
LASSERT(qqi->qqi_acct_obj == NULL);
qsd->qsd_stopping = true;
write_unlock(&qsd->qsd_lock);
qsd->qsd_stopping = true;
write_unlock(&qsd->qsd_lock);
- /* remove from the list of fsinfo */
- if (!cfs_list_empty(&qsd->qsd_link)) {
- LASSERT(qsd->qsd_fsinfo != NULL);
- down(&qsd->qsd_fsinfo->qfs_sem);
- cfs_list_del_init(&qsd->qsd_link);
- up(&qsd->qsd_fsinfo->qfs_sem);
- }
-
/* remove qsd proc entry */
if (qsd->qsd_proc != NULL) {
lprocfs_remove(&qsd->qsd_proc);
/* remove qsd proc entry */
if (qsd->qsd_proc != NULL) {
lprocfs_remove(&qsd->qsd_proc);
lustre_deregister_osp_item(&qsd->qsd_exp);
/* release per-filesystem information */
lustre_deregister_osp_item(&qsd->qsd_exp);
/* release per-filesystem information */
- if (qsd->qsd_fsinfo != NULL)
+ if (qsd->qsd_fsinfo != NULL) {
+ down(&qsd->qsd_fsinfo->qfs_sem);
+ /* remove from the list of fsinfo */
+ cfs_list_del_init(&qsd->qsd_link);
+ up(&qsd->qsd_fsinfo->qfs_sem);
qsd_put_fsinfo(qsd->qsd_fsinfo);
qsd_put_fsinfo(qsd->qsd_fsinfo);
+ qsd->qsd_fsinfo = NULL;
+ }
/* release quota root directory */
if (qsd->qsd_root != NULL) {
/* release quota root directory */
if (qsd->qsd_root != NULL) {
qqi = lock->l_ast_data;
if (qqi != NULL) {
qqi_getref(qqi);
qqi = lock->l_ast_data;
if (qqi != NULL) {
qqi_getref(qqi);
- lu_ref_add(&qqi->qqi_reference, "ast_data_get", lock);
if (reset)
lock->l_ast_data = NULL;
}
unlock_res_and_lock(lock);
if (reset)
lock->l_ast_data = NULL;
}
unlock_res_and_lock(lock);
+ if (qqi != NULL)
+ /* it is not safe to call lu_ref_add() under spinlock */
+ lu_ref_add(&qqi->qqi_reference, "ast_data_get", lock);
+
if (reset && qqi != NULL) {
/* release qqi reference hold for the lock */
if (reset && qqi != NULL) {
/* release qqi reference hold for the lock */
lu_ref_del(&qqi->qqi_reference, "glb_lock", lock);
lu_ref_del(&qqi->qqi_reference, "glb_lock", lock);
ldlm_lock_dump_handle(D_QUOTA, lockh);
if (rlockh == NULL)
ldlm_lock_dump_handle(D_QUOTA, lockh);
if (rlockh == NULL)
+ /* caller not interested in remote handle */
RETURN(0);
/* look up lock associated with local handle and extract remote handle
RETURN(0);
/* look up lock associated with local handle and extract remote handle
req->rq_bulk->bd_nob_transferred);
if (rc < 0)
GOTO(out, rc);
req->rq_bulk->bd_nob_transferred);
if (rc < 0)
GOTO(out, rc);
+ else
+ /* sptlrpc_cli_unwrap_bulk_read() returns the number of bytes
+ * transferred*/
+ rc = 0;
req_ii = req_capsule_server_get(&req->rq_pill, &RMF_IDX_INFO);
*ii = *req_ii;
req_ii = req_capsule_server_get(&req->rq_pill, &RMF_IDX_INFO);
*ii = *req_ii;
* \param qid - quota id
* \param rec - global or slave record to be updated to disk
* \param ver - new index file version
* \param qid - quota id
* \param rec - global or slave record to be updated to disk
* \param ver - new index file version
- * \param global- ture : master record; false : slave record
+ * \param global- true: master record; false: slave record
*/
void qsd_upd_schedule(struct qsd_qtype_info *qqi, struct lquota_entry *lqe,
union lquota_id *qid, union lquota_rec *rec, __u64 ver,
*/
void qsd_upd_schedule(struct qsd_qtype_info *qqi, struct lquota_entry *lqe,
union lquota_id *qid, union lquota_rec *rec, __u64 ver,