Whamcloud - gitweb
LU-7531 osp: allow few requests during recovery
[fs/lustre-release.git] / lustre / osp / osp_md_object.c
index 69c815c..643e31a 100644 (file)
@@ -885,6 +885,7 @@ static int osp_md_object_lock(const struct lu_env *env,
        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 ptlrpc_request   *req;
        int                     rc = 0;
        __u64                   flags = 0;
@@ -907,6 +908,15 @@ 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;
+
        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);