+#ifdef ZFS_PROJINHERIT
+ if (attr && attr->la_valid & LA_PROJID) {
+ if (!osd->od_projectused_dn)
+ GOTO(out, rc = -EOPNOTSUPP);
+
+ /* Usually, if project quota is upgradable for the device,
+ * then the upgrade will be done before or when mount the
+ * device. So when we come here, this project should have
+ * project ID attribute already (that is zero by default).
+ * Otherwise, there was something wrong during the former
+ * upgrade, let's return failure to report that.
+ *
+ * Please note that, different from other attributes, you
+ * can NOT simply set the project ID attribute under such
+ * case, because adding (NOT change) project ID attribute
+ * needs to change the object's attribute layout to match
+ * zfs backend quota accounting requirement. */
+ if (unlikely(!obj->oo_with_projid))
+ GOTO(out, rc = -ENXIO);
+
+ /* quota enforcement for project */
+ if (attr->la_projid != obj->oo_attr.la_projid) {
+ rc = qsd_transfer(env, osd->od_quota_slave,
+ &oh->ot_quota_trans, PRJQUOTA,
+ obj->oo_attr.la_projid,
+ attr->la_projid, bspace,
+ &info->oti_qi);
+ if (rc)
+ GOTO(out, rc);
+ }
+ }
+#endif