+ if (!is_updated) {
+ if (th != NULL && !IS_ERR(th))
+ dt_trans_stop(env, qmt->qmt_child, th);
+ qti_lqes_restore_fini(env);
+ }
+
+ if (rc == 0 && dirtied) {
+ qmt_glb_lock_notify(env, lqe, ver);
+ if (lqe->lqe_id.qid_uid == 0) {
+ struct qmt_entry_iter_data iter_data;
+
+ LQUOTA_DEBUG(lqe, "notify all lqe with default quota");
+ iter_data.qeid_env = env;
+ iter_data.qeid_qmt = qmt;
+ cfs_hash_for_each(lqe->lqe_site->lqs_hash,
+ qmt_entry_iter_cb, &iter_data);
+ /* Always notify slaves with default values. Don't
+ * care about overhead as will be sent only not changed
+ * values(see qmt_id_lock_cb for details).*/
+ need_id_notify = true;
+ }
+ /* qti_lqes_inited > 0 means we came here from another
+ * qmt_pool_lqes_lookup(qmt_dqacq, intent_policy ...). Thus
+ * we can't init and add new lqes to don't overwrite already
+ * added.
+ */
+ if (!qti_lqes_inited(env) && need_id_notify)
+ qmt_set_id_notify(env, qmt, lqe);
+ }
+
+ return rc;
+}
+
+/*
+ * Update quota settings for a given identifier.
+ *
+ * \param env - is the environment passed by the caller
+ * \param qmt - is the quota master target
+ * \param restype - is the pool type, either block (i.e. LQUOTA_RES_DT) or
+ * inode (i.e. LQUOTA_RES_MD)
+ * \param qtype - is the quota type
+ * \param id - is the quota indentifier for which we want to modify
+ * quota settings.
+ * \param hard - is the new hard limit
+ * \param soft - is the new soft limit
+ * \param time - is the new grace time
+ * \param valid - is the list of settings to change
+ * \param is_default - true for default quota setting
+ * \param is_updated - true if the lqe is updated and no need to write back
+ */
+static int qmt_set(const struct lu_env *env, struct qmt_device *qmt,
+ __u8 restype, __u8 qtype, union lquota_id *id,
+ __u64 hard, __u64 soft, __u64 time, __u32 valid,
+ bool is_default, bool is_updated, char *pool_name)
+{
+ struct lquota_entry *lqe;
+ int rc;
+ ENTRY;
+
+ if (pool_name && !strnlen(pool_name, LOV_MAXPOOLNAME))
+ pool_name = NULL;
+
+ /* look-up quota entry associated with this ID */
+ lqe = qmt_pool_lqe_lookup(env, qmt, restype, qtype, id, pool_name);
+ if (IS_ERR(lqe))
+ RETURN(PTR_ERR(lqe));
+
+ lqe->lqe_is_deleted = 0;
+ lqe->lqe_is_reset = 0;
+ rc = qmt_set_with_lqe(env, qmt, lqe, hard, soft, time, valid,
+ is_default, is_updated);
+ if (rc == 0)
+ lqe->lqe_is_deleted = 0;
+