Whamcloud - gitweb
LU-15048 quota: check that qti_lqes has been inited
[fs/lustre-release.git] / lustre / quota / qmt_handler.c
index 5e7f2f5..28b860e 100644 (file)
@@ -260,9 +260,11 @@ out:
        lqe_write_unlock(lqe);
 
 out_nolock:
-       qti_lqes_restore_fini(env);
-       if (th != NULL && !IS_ERR(th))
-               dt_trans_stop(env, qmt->qmt_child, th);
+       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);
@@ -279,7 +281,12 @@ out_nolock:
                         * values(see qmt_id_lock_cb for details).*/
                        need_id_notify = true;
                }
-               if (need_id_notify)
+               /* 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);
        }