Whamcloud - gitweb
LU-5691 hsm: remove a request from the index if not present in the store
[fs/lustre-release.git] / lustre / mdt / mdt_coordinator.c
index 0a43d93..ac5518f 100644 (file)
@@ -336,6 +336,15 @@ static int mdt_coordinator_cb(const struct lu_env *env,
                                       hsm_copytool_action2name(
                                                     larr->arr_hai.hai_action));
 
+                       if (rc == -ENOENT) {
+                               /* The request no longer exists, forget
+                                * about it, and do not send a cancel request
+                                * to the client, for which an error will be
+                                * sent back, leading to an endless cycle of
+                                * cancellation. */
+                               RETURN(LLOG_DEL_RECORD);
+                       }
+
                        /* add the cookie to the list of record to be
                         * canceled by caller */
                        if (hsd->max_cookie == (hsd->cookie_cnt - 1)) {
@@ -868,9 +877,9 @@ int mdt_hsm_cdt_init(struct mdt_device *mdt)
        init_rwsem(&cdt->cdt_request_lock);
        mutex_init(&cdt->cdt_restore_lock);
 
-       CFS_INIT_LIST_HEAD(&cdt->cdt_requests);
-       CFS_INIT_LIST_HEAD(&cdt->cdt_agents);
-       CFS_INIT_LIST_HEAD(&cdt->cdt_restore_hdl);
+       INIT_LIST_HEAD(&cdt->cdt_requests);
+       INIT_LIST_HEAD(&cdt->cdt_agents);
+       INIT_LIST_HEAD(&cdt->cdt_restore_hdl);
 
        rc = lu_env_init(&cdt->cdt_env, LCT_MD_THREAD);
        if (rc < 0)