- if ((last + cdt->cdt_active_req_timeout)
- < cfs_time_current_sec()) {
- struct hsm_progress_kernel pgs;
-
- dump_llog_agent_req_rec("mdt_coordinator_cb(): "
- "request timeouted, start "
- "cleaning", larr);
- /* a too old cancel request just needs to be removed
- * this can happen, if copy tool does not support cancel
- * for other requests, we have to remove the running
- * request and notify the copytool
- */
- pgs.hpk_fid = larr->arr_hai.hai_fid;
- pgs.hpk_cookie = larr->arr_hai.hai_cookie;
- pgs.hpk_extent = larr->arr_hai.hai_extent;
- pgs.hpk_flags = HP_FLAG_COMPLETED;
- pgs.hpk_errval = ENOSYS;
- pgs.hpk_data_version = 0;
- /* update request state, but do not record in llog, to
- * avoid deadlock on cdt_llog_lock
- */
- rc = mdt_hsm_update_request_state(hsd->mti, &pgs, 0);
- if (rc)
- CERROR("%s: Cannot cleanup timeouted request: "
- DFID" for cookie "LPX64" action=%s\n",
- mdt_obd_name(mdt),
- PFID(&pgs.hpk_fid), pgs.hpk_cookie,
- hsm_copytool_action2name(
- larr->arr_hai.hai_action));
-
- /* add the cookie to the list of record to be
- * canceled by caller */
- if (hsd->max_cookie == (hsd->cookie_cnt - 1)) {
- __u64 *ptr, *old_ptr;
- int old_sz, new_sz, new_cnt;
-
- /* need to increase vector size */
- old_sz = sizeof(__u64) * hsd->max_cookie;
- old_ptr = hsd->cookies;
-
- new_cnt = 2 * hsd->max_cookie;
- new_sz = sizeof(__u64) * new_cnt;
-
- OBD_ALLOC(ptr, new_sz);
- if (!ptr) {
- CERROR("%s: Cannot allocate memory "
- "(%d o) for cookie vector\n",
- mdt_obd_name(mdt), new_sz);
- RETURN(-ENOMEM);
- }
- memcpy(ptr, hsd->cookies, old_sz);
- hsd->cookies = ptr;
- hsd->max_cookie = new_cnt;
- OBD_FREE(old_ptr, old_sz);
- }
- hsd->cookies[hsd->cookie_cnt] =
- larr->arr_hai.hai_cookie;
- hsd->cookie_cnt++;
+ if (now <= last + cdt->cdt_active_req_timeout)
+ RETURN(0);
+
+ dump_llog_agent_req_rec("request timed out, start cleaning",
+ larr);
+ /* a too old cancel request just needs to be removed
+ * this can happen, if copy tool does not support
+ * cancel for other requests, we have to remove the
+ * running request and notify the copytool */
+ pgs.hpk_fid = larr->arr_hai.hai_fid;
+ pgs.hpk_cookie = larr->arr_hai.hai_cookie;
+ pgs.hpk_extent = larr->arr_hai.hai_extent;
+ pgs.hpk_flags = HP_FLAG_COMPLETED;
+ pgs.hpk_errval = ENOSYS;
+ pgs.hpk_data_version = 0;
+
+ /* update request state, but do not record in llog, to
+ * avoid deadlock on cdt_llog_lock */
+ rc = mdt_hsm_update_request_state(hsd->mti, &pgs, 0);
+ if (rc)
+ CERROR("%s: cannot cleanup timed out request: "
+ DFID" for cookie %#llx action=%s\n",
+ mdt_obd_name(mdt),
+ PFID(&pgs.hpk_fid), pgs.hpk_cookie,
+ 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);