Whamcloud - gitweb
LU-7117 osp: set ptlrpc_request::rq_allow_replay properly
[fs/lustre-release.git] / lustre / osp / osp_md_object.c
index a976fec..4d72051 100644 (file)
@@ -869,12 +869,11 @@ static int osp_md_object_lock(const struct lu_env *env,
                              union ldlm_policy_data *policy)
 {
        struct ldlm_res_id      *res_id;
-       struct dt_device        *dt_dev = lu2dt_dev(dt->do_lu.lo_dev);
-       struct osp_device       *osp = dt2osp_dev(dt_dev);
-       struct lu_device        *top_device;
+       struct osp_device       *osp = dt2osp_dev(lu2dt_dev(dt->do_lu.lo_dev));
        struct ptlrpc_request   *req;
        int                     rc = 0;
        __u64                   flags = LDLM_FL_NO_LRU;
+       ENTRY;
 
        res_id = einfo->ei_res_id;
        LASSERT(res_id != NULL);
@@ -888,22 +887,14 @@ static int osp_md_object_lock(const struct lu_env *env,
        if (IS_ERR(req))
                RETURN(PTR_ERR(req));
 
-       /* During recovery, it needs to let OSP send enqueue
-        * without checking recoverying status, in case the
-        * other target is being recovered at the same time,
-        * and if we wait here for the import to be recovered,
-        * it might cause deadlock */
-       top_device = dt_dev->dd_lu_dev.ld_site->ls_top_dev;
-       if (top_device->ld_obd->obd_recovering)
-               req->rq_allow_replay = 1;
-
+       osp_set_req_replay(osp, req);
        rc = ldlm_cli_enqueue(osp->opd_exp, &req, einfo, res_id,
                              (const union ldlm_policy_data *)policy,
                              &flags, NULL, 0, LVB_T_NONE, lh, 0);
 
        ptlrpc_req_finished(req);
 
-       return rc == ELDLM_OK ? 0 : -EIO;
+       RETURN(rc == ELDLM_OK ? 0 : -EIO);
 }
 
 /**
@@ -1189,10 +1180,7 @@ static ssize_t osp_md_read(const struct lu_env *env, struct dt_object *dt,
                ptr += read_size;
        }
 
-       /* This will only be called with read-only update, and these updates
-        * might be used to retrieve update log during recovery process, so
-        * it will be allowed to send during recovery process */
-       req->rq_allow_replay = 1;
+       osp_set_req_replay(osp, req);
        req->rq_bulk_read = 1;
        /* send request to master and wait for RPC to complete */
        rc = ptlrpc_queue_wait(req);