X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmdt%2Fmdt_hsm_cdt_agent.c;h=c97be7100e36c2577a679e903ee14df9447402fa;hb=12ac7f2baa3691eaf74d468aedb7615f6ddf6d60;hp=9a9ce6d7b8cdddeb78c30ef6a88fc4b67805b807;hpb=c54e61cef76eb0e00c9e69729cf4ac8578c90f47;p=fs%2Flustre-release.git diff --git a/lustre/mdt/mdt_hsm_cdt_agent.c b/lustre/mdt/mdt_hsm_cdt_agent.c index 9a9ce6d..c97be71 100644 --- a/lustre/mdt/mdt_hsm_cdt_agent.c +++ b/lustre/mdt/mdt_hsm_cdt_agent.c @@ -40,6 +40,7 @@ #include #include #include +#include #include "mdt_internal.h" /* @@ -48,7 +49,7 @@ /* * find a hsm_agent by uuid - * lock cdt_agent_lock needs to be hold by caller + * lock cdt_agent_lock needs to be held by caller * \param cdt [IN] coordinator * \param uuid [IN] agent UUID * \retval hsm_agent pointer or NULL if not found @@ -343,18 +344,10 @@ int mdt_hsm_agent_send(struct mdt_thread_info *mti, hal->hal_archive_id); len = hal_size(hal); - if (kuc_ispayload(hal)) { - /* hal is already a kuc payload - * we do not need to alloc a new one - * this avoid a alloc/memcpy/free - */ - buf = hal; - } else { - buf = kuc_alloc(len, KUC_TRANSPORT_HSM, HMT_ACTION_LIST); - if (IS_ERR(buf)) - RETURN(PTR_ERR(buf)); - memcpy(buf, hal, len); - } + buf = kuc_alloc(len, KUC_TRANSPORT_HSM, HMT_ACTION_LIST); + if (IS_ERR(buf)) + RETURN(PTR_ERR(buf)); + memcpy(buf, hal, len); /* Check if request is still valid (cf file hsm flags) */ fail_request = false; @@ -413,6 +406,33 @@ int mdt_hsm_agent_send(struct mdt_thread_info *mti, hai->hai_cookie, rc); GOTO(out_buf, rc); } + + /* if restore and record status updated, give + * back granted layout lock */ + if (hai->hai_action == HSMA_RESTORE) { + struct cdt_restore_handle *crh = NULL; + struct mdt_object *obj = NULL; + + mutex_lock(&cdt->cdt_restore_lock); + crh = mdt_hsm_restore_hdl_find(cdt, + &hai->hai_fid); + if (crh != NULL) + list_del(&crh->crh_list); + mutex_unlock(&cdt->cdt_restore_lock); + obj = mdt_object_find(mti->mti_env, + mti->mti_mdt, + &hai->hai_fid); + if (!IS_ERR(obj) && crh != NULL) + mdt_object_unlock(mti, obj, + &crh->crh_lh, + 1); + if (crh != NULL) + OBD_SLAB_FREE_PTR(crh, + mdt_hsm_cdt_kmem); + if (!IS_ERR(obj)) + mdt_object_put(mti->mti_env, + obj); + } } } } @@ -486,8 +506,7 @@ out: } out_buf: - if (buf != hal) - kuc_free(buf, len); + kuc_free(buf, len); RETURN(rc); } @@ -505,7 +524,7 @@ int mdt_hsm_coordinator_update(struct mdt_thread_info *mti, int rc; ENTRY; - /* ask to coodinator to update request state and + /* ask to coordinator to update request state and * to record on disk the result */ rc = mdt_hsm_update_request_state(mti, pgs, 1); RETURN(rc); @@ -621,15 +640,12 @@ static int lprocfs_open_hsm_agent(struct inode *inode, struct file *file) int rc; ENTRY; - if (LPROCFS_ENTRY_CHECK(PDE(inode))) - RETURN(-ENOENT); - rc = seq_open(file, &mdt_hsm_agent_proc_ops); if (rc) RETURN(rc); s = file->private_data; - s->private = PDE(inode)->data; + s->private = PDE_DATA(inode); RETURN(rc); }