extern struct obd_ops lwp_obd_device_ops;
extern struct lu_device_type lwp_device_type;
+static inline struct lu_device *osp2top(const struct osp_device *osp)
+{
+ return osp->opd_dt_dev.dd_lu_dev.ld_site->ls_top_dev;
+}
+
+static inline void osp_set_req_replay(const struct osp_device *osp,
+ struct ptlrpc_request *req)
+{
+ struct obd_device *obd = osp2top(osp)->ld_obd;
+
+ /* The RPC must be recovery related for the cases:
+ *
+ * 1. sent during recovery, or
+ * 2. sent before the recovery thread target_recovery_thread() start,
+ * such as triggered by lod_sub_recovery_thread(). */
+ if (obd->obd_recovering || (obd->obd_replayable && obd->obd_no_conn))
+ req->rq_allow_replay = 1;
+}
+
#endif
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);
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);
}
/**
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);
struct lu_device *dev = it->ooi_obj->do_lu.lo_dev;
struct osp_device *osp = lu2osp_dev(dev);
struct page **pages;
- struct lu_device *top_device;
struct ptlrpc_request *req = NULL;
struct ptlrpc_bulk_desc *desc;
struct idx_info *ii;
RETURN(rc);
}
- /* Let's allow this request during recovery, otherwise
- * if the remote target is also in recovery status,
- * it might cause deadlock */
- top_device = dev->ld_site->ls_top_dev;
- if (top_device->ld_obd->obd_recovering)
- req->rq_allow_replay = 1;
-
+ osp_set_req_replay(osp, req);
req->rq_request_portal = OUT_PORTAL;
ii = req_capsule_client_get(&req->rq_pill, &RMF_IDX_INFO);
memset(ii, 0, sizeof(*ii));
if (rc != 0)
RETURN(rc);
- /* 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_allow_intr = 1;
/* Note: some dt index api might return non-zero result here, like
{
struct osp_update_args *args;
struct ptlrpc_request *req;
- struct lu_device *top_device;
struct osp_thandle *oth = our->our_th;
int rc = 0;
ENTRY;
* status, in case the other target is being recoveried
* at the same time, and if we wait here for the import
* to be recoveryed, it might cause deadlock */
- top_device = osp->opd_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);
/* Because this req will be synchronus, i.e. it will be called
* in the same thread, so it will be safe to use current