@@ -1018,7 +1018,9 @@ struct ldlm_enqueue_info {
/* whether enqueue slave stripes */
unsigned int ei_enq_slave:1;
/* whether acquire rpc slot */
- unsigned int ei_enq_slot:1;
+ unsigned int ei_req_slot:1;
+ /** whether acquire mod rpc slot */
+ unsigned int ei_mod_slot:1;
};
extern struct obd_ops ldlm_obd_ops;
@@ -1343,7 +1345,8 @@ int ldlm_prep_elc_req(struct obd_export *exp,
int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
struct ldlm_enqueue_info *einfo, u8 with_policy,
u64 *flags, void *lvb, u32 lvb_len,
- const struct lustre_handle *lockh, int rc);
+ const struct lustre_handle *lockh, int rc,
+ bool request_slot);
int ldlm_cli_convert_req(struct ldlm_lock *lock, u32 *flags, u64 new_bits);
int ldlm_cli_convert(struct ldlm_lock *lock,
enum ldlm_cancel_flags cancel_flags);
@@ -722,6 +722,7 @@ enum md_cli_flags {
CLI_API32 = BIT(3),
CLI_MIGRATE = BIT(4),
CLI_DIRTY_DATA = BIT(5),
+ CLI_NO_SLOT = BIT(6),
};
enum md_op_code {
@@ -359,7 +359,9 @@ static bool ldlm_request_slot_needed(struct ldlm_enqueue_info *einfo)
/* exclude EXTENT locks and DOM-only IBITS locks because they
* are asynchronous and don't wait on server being blocked.
*/
- return einfo->ei_type == LDLM_FLOCK || einfo->ei_type == LDLM_IBITS;
+ return einfo->ei_req_slot &&
+ (einfo->ei_type == LDLM_FLOCK ||
+ einfo->ei_type == LDLM_IBITS);
}
/**
@@ -371,7 +373,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
struct ldlm_enqueue_info *einfo,
u8 with_policy, u64 *ldlm_flags, void *lvb,
u32 lvb_len, const struct lustre_handle *lockh,
- int rc)
+ int rc, bool request_slot)
{
struct ldlm_namespace *ns = exp->exp_obd->obd_namespace;
const struct lu_env *env = NULL;
@@ -380,7 +382,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req,
struct ldlm_reply *reply;
int cleanup_phase = 1;
- if (ldlm_request_slot_needed(einfo))
+ if (request_slot)
obd_put_request_slot(&req->rq_import->imp_obd->u.cli);
ptlrpc_put_mod_rpc_slot(req);
@@ -726,6 +728,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
int is_replay = *flags & LDLM_FL_REPLAY;
int req_passed_in = 1;
int rc, err;
+ bool need_req_slot;
struct ptlrpc_request *req;
ns = exp->exp_obd->obd_namespace;
@@ -829,13 +832,14 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
* that threads that are waiting for a modify RPC slot are not polluting
* our rpcs in flight counter.
*/
- if (einfo->ei_enq_slot)
+ if (einfo->ei_mod_slot)
ptlrpc_get_mod_rpc_slot(req);
- if (ldlm_request_slot_needed(einfo)) {
+ need_req_slot = ldlm_request_slot_needed(einfo);
+ if (need_req_slot) {
rc = obd_get_request_slot(&req->rq_import->imp_obd->u.cli);
if (rc) {
- if (einfo->ei_enq_slot)
+ if (einfo->ei_mod_slot)
ptlrpc_put_mod_rpc_slot(req);
failed_lock_cleanup(ns, lock, einfo->ei_mode);
LDLM_LOCK_RELEASE(lock);
@@ -855,7 +859,7 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
rc = ptlrpc_queue_wait(req);
err = ldlm_cli_enqueue_fini(exp, req, einfo, policy ? 1 : 0, flags,
- lvb, lvb_len, lockh, rc);
+ lvb, lvb_len, lockh, rc, need_req_slot);
/*
* If ldlm_cli_enqueue_fini did not find the lock, we need to free
@@ -380,6 +380,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
einfo->ei_cb_cp = ldlm_completion_ast;
einfo->ei_cb_gl = NULL;
einfo->ei_cbdata = NULL;
+ einfo->ei_req_slot = 1;
return minfo;
}
@@ -106,6 +106,7 @@ static int lmv_intent_remote(struct obd_export *exp, struct lookup_intent *it,
}
op_data->op_bias = MDS_CROSS_REF;
+ op_data->op_cli_flags = CLI_NO_SLOT;
CDEBUG(D_INODE, "REMOTE_INTENT with fid=" DFID " -> mds #%u\n",
PFID(&body->mbo_fid1), tgt->ltd_index);
@@ -203,6 +204,7 @@ int lmv_revalidate_slaves(struct obd_export *exp,
* it's remote object.
*/
op_data->op_bias = MDS_CROSS_REF;
+ op_data->op_cli_flags = CLI_NO_SLOT;
tgt = lmv_tgt(lmv, lsm->lsm_md_oinfo[i].lmo_mds);
if (!tgt) {
@@ -66,6 +66,7 @@ static void mdc_lock_build_einfo(const struct lu_env *env,
einfo->ei_cb_cp = ldlm_completion_ast;
einfo->ei_cb_gl = mdc_ldlm_glimpse_ast;
einfo->ei_cbdata = osc; /* value to be put into ->l_ast_data */
+ einfo->ei_req_slot = 1;
}
static void mdc_lock_lvb_update(const struct lu_env *env,
@@ -664,7 +665,7 @@ int mdc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
/* Complete obtaining the lock procedure. */
rc = ldlm_cli_enqueue_fini(aa->oa_exp, req, &einfo, 1, aa->oa_flags,
aa->oa_lvb, aa->oa_lvb ?
- sizeof(*aa->oa_lvb) : 0, lockh, rc);
+ sizeof(*aa->oa_lvb) : 0, lockh, rc, true);
/* Complete mdc stuff. */
rc = mdc_enqueue_fini(aa->oa_exp, req, aa->oa_upcall, aa->oa_cookie,
lockh, mode, aa->oa_flags, rc);
@@ -984,7 +984,8 @@ int mdc_enqueue_base(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
req->rq_sent = ktime_get_real_seconds() + resends;
}
- einfo->ei_enq_slot = !mdc_skip_mod_rpc_slot(it);
+ einfo->ei_req_slot = !(op_data->op_cli_flags & CLI_NO_SLOT);
+ einfo->ei_mod_slot = !mdc_skip_mod_rpc_slot(it);
/* With Data-on-MDT the glimpse callback is needed too.
* It is set here in advance but not in mdc_finish_enqueue()
@@ -1371,7 +1372,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env,
rc = -ETIMEDOUT;
rc = ldlm_cli_enqueue_fini(exp, req, einfo, 1, &flags, NULL, 0,
- lockh, rc);
+ lockh, rc, true);
if (rc < 0) {
CERROR("%s: ldlm_cli_enqueue_fini() failed: rc = %d\n",
exp->exp_obd->obd_name, rc);
@@ -2824,7 +2824,7 @@ int osc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
/* Complete obtaining the lock procedure. */
rc = ldlm_cli_enqueue_fini(aa->oa_exp, req, &einfo, 1, aa->oa_flags,
- lvb, lvb_len, lockh, rc);
+ lvb, lvb_len, lockh, rc, false);
/* Complete osc stuff. */
rc = osc_enqueue_fini(req, aa->oa_upcall, aa->oa_cookie, lockh, mode,
aa->oa_flags, aa->oa_speculative, rc);