oh = container_of0(th, struct osd_thandle, ot_super);
LASSERT(oh->ot_tx != NULL);
+ dmu_tx_mark_netfree(oh->ot_tx);
+
/* declare that we'll remove object from fid-dnode mapping */
zapid = osd_get_name_n_idx(env, osd, fid, NULL, 0, &dn);
osd_tx_hold_zap(oh->ot_tx, zapid, dn, FALSE, NULL);
struct qsd_instance *qsd,
struct lquota_trans *trans, int qtype,
__u64 orig_id, __u64 new_id, __u64 bspace,
- struct lquota_id_info *qi)
+ struct lquota_id_info *qi, bool ignore_edquot)
{
int rc;
qi->lqi_id.qid_uid = new_id;
qi->lqi_space = 1;
rc = qsd_op_begin(env, qsd, trans, qi, NULL);
- if (rc == -EDQUOT || rc == -EINPROGRESS)
+ if (ignore_edquot && (rc == -EDQUOT || rc == -EINPROGRESS))
rc = 0;
if (rc)
return rc;
qi->lqi_id.qid_uid = new_id;
qi->lqi_space = bspace;
rc = qsd_op_begin(env, qsd, trans, qi, NULL);
- if (rc == -EDQUOT || rc == -EINPROGRESS)
+ if (ignore_edquot && (rc == -EDQUOT || rc == -EINPROGRESS))
rc = 0;
if (rc)
return rc;
if (attr && (attr->la_valid & (LA_UID | LA_GID | LA_PROJID))) {
sa_object_size(obj->oo_sa_hdl, &blksize, &bspace);
- bspace = toqb(bspace * blksize);
+ bspace = toqb(bspace * 512);
+
+ CDEBUG(D_QUOTA, "%s: enforce quota on UID %u, GID %u,"
+ "the quota space is %lld (%u)\n", osd->od_svname,
+ attr->la_uid, attr->la_gid, bspace, blksize);
}
if (attr && attr->la_valid & LA_UID) {
rc = qsd_transfer(env, osd->od_quota_slave,
&oh->ot_quota_trans, USRQUOTA,
obj->oo_attr.la_uid, attr->la_uid,
- bspace, &info->oti_qi);
+ bspace, &info->oti_qi, true);
if (rc)
GOTO(out, rc);
}
rc = qsd_transfer(env, osd->od_quota_slave,
&oh->ot_quota_trans, GRPQUOTA,
obj->oo_attr.la_gid, attr->la_gid,
- bspace, &info->oti_qi);
+ bspace, &info->oti_qi,
+ !(attr->la_flags &
+ LUSTRE_SET_SYNC_FL));
if (rc)
GOTO(out, rc);
}
&oh->ot_quota_trans, PRJQUOTA,
obj->oo_attr.la_projid,
attr->la_projid, bspace,
- &info->oti_qi);
+ &info->oti_qi, true);
if (rc)
GOTO(out, rc);
}
zapid = osd_get_name_n_idx(env, osd, fid, buf,
sizeof(info->oti_str), &zdn);
- if (!CFS_FAIL_CHECK(OBD_FAIL_OSD_NO_OI_ENTRY)) {
- if (osd->od_is_ost &&
- OBD_FAIL_CHECK(OBD_FAIL_OSD_COMPAT_INVALID_ENTRY))
- zde->zde_dnode++;
-
- if (!osd->od_is_ost ||
- !OBD_FAIL_CHECK(OBD_FAIL_OSD_COMPAT_NO_ENTRY)) {
- rc = osd_zap_add(osd, zapid, zdn, buf, 8, 1,
- zde, oh->ot_tx);
- if (rc)
- GOTO(out, rc);
- }
- }
+ if (CFS_FAIL_CHECK(OBD_FAIL_OSD_NO_OI_ENTRY) ||
+ (osd->od_is_ost && OBD_FAIL_CHECK(OBD_FAIL_OSD_COMPAT_NO_ENTRY)))
+ goto skip_add;
+
+ if (osd->od_is_ost && OBD_FAIL_CHECK(OBD_FAIL_OSD_COMPAT_INVALID_ENTRY))
+ zde->zde_dnode++;
+
+ rc = osd_zap_add(osd, zapid, zdn, buf, 8, 1, zde, oh->ot_tx);
+ if (rc)
+ GOTO(out, rc);
+skip_add:
obj->oo_dn = dn;
/* Now add in all of the "SA" attributes */
rc = osd_sa_handle_get(obj);