From: Andriy Skulysh Date: Fri, 30 Aug 2019 11:43:29 +0000 (+0300) Subject: LU-15121 llite: skip request slot for lmv_revalidate_slaves() X-Git-Tag: 2.14.56~77 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F75%2F45275%2F2;p=fs%2Flustre-release.git LU-15121 llite: skip request slot for lmv_revalidate_slaves() Some syscalls need lmv_revalidate_slaves(). It requires second lock enqueue and the it can be blocked by lack of RPC slots. Don't acquire rpc slot for second lock enqueue. Change-Id: Ida23c648c2bd169c4d238543731796232aa490dc HPE-bug-id: LUS-8416 Signed-off-by: Andriy Skulysh Reviewed-by: Vitaly Fertman Reviewed-by: Alexander Zarochentsev Reviewed-on: https://review.whamcloud.com/45275 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Vitaly Fertman Reviewed-by: Alexander Zarochentsev Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index ee4dea1..d40bcc8 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -1256,7 +1256,8 @@ struct ldlm_enqueue_info { void *ei_namespace; /** lock namespace **/ u64 ei_inodebits; /** lock inode bits **/ unsigned int ei_enq_slave:1; /** whether enqueue slave stripes */ - unsigned int ei_enq_slot:1; /** whether acquire rpc slot */ + unsigned int ei_req_slot:1; /** whether acquire rpc slot */ + unsigned int ei_mod_slot:1; /** whether acquire mod rpc slot */ }; #define ei_res_id ei_cb_gl @@ -1732,7 +1733,8 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns, struct ptlrpc_request *req, 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_enqueue_local(const struct lu_env *env, struct ldlm_namespace *ns, const struct ldlm_res_id *res_id, diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 5990034..da71340 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -854,6 +854,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 { diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index bb1fa108..23bcfda 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -593,9 +593,10 @@ 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 && - einfo->ei_inodebits != MDS_INODELOCK_DOM); + return einfo->ei_req_slot && + (einfo->ei_type == LDLM_FLOCK || + (einfo->ei_type == LDLM_IBITS && + einfo->ei_inodebits != MDS_INODELOCK_DOM)); } /** @@ -607,7 +608,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; @@ -618,7 +619,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, ENTRY; - 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); @@ -977,6 +978,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; ENTRY; @@ -1088,13 +1090,15 @@ 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); @@ -1114,7 +1118,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 diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index 437a881..4302f4b 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -378,6 +378,7 @@ static int __lfsck_ibits_lock(const struct lu_env *env, einfo->ei_cb_bl = ldlm_blocking_ast; einfo->ei_cb_cp = ldlm_completion_ast; einfo->ei_res_id = resid; + einfo->ei_req_slot = 1; rc = dt_object_lock(env, obj, lh, einfo, policy); /* for regular checks LFSCK doesn't use LDLM locking, diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 48deda0..1154516 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -393,6 +393,7 @@ sa_prep_data(struct inode *dir, struct inode *child, struct sa_entry *entry) einfo->ei_cb_cp = ldlm_completion_ast; einfo->ei_cb_gl = NULL; einfo->ei_cbdata = NULL; + einfo->ei_req_slot = 1; return minfo; } diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 38be08d..ef04c5b 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -104,6 +104,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); @@ -205,6 +206,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) diff --git a/lustre/mdc/mdc_dev.c b/lustre/mdc/mdc_dev.c index d7719e1..bd67c30 100644 --- a/lustre/mdc/mdc_dev.c +++ b/lustre/mdc/mdc_dev.c @@ -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, @@ -682,7 +683,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); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index f0ee92e..93c5622 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -990,7 +990,8 @@ resend: 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() @@ -1382,7 +1383,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); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 3040be6..da4e5c1 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -3694,6 +3694,7 @@ int mdt_remote_object_lock_try(struct mdt_thread_info *mti, einfo->ei_cb_cp = ldlm_completion_ast; einfo->ei_enq_slave = 0; einfo->ei_res_id = res_id; + einfo->ei_req_slot = 1; if (cache) { /* diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 45cdfb0..0e662cf 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -292,6 +292,7 @@ static int mdt_lock_slaves(struct mdt_thread_info *mti, struct mdt_object *obj, einfo->ei_enq_slave = 1; einfo->ei_namespace = mti->mti_mdt->mdt_namespace; einfo->ei_inodebits = ibits; + einfo->ei_req_slot = 1; memset(policy, 0, sizeof(*policy)); policy->l_inodebits.bits = ibits; diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 933fc8f..fcac713 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -2804,7 +2804,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); diff --git a/lustre/quota/qsd_request.c b/lustre/quota/qsd_request.c index ead0adf..de5726d 100644 --- a/lustre/quota/qsd_request.c +++ b/lustre/quota/qsd_request.c @@ -173,7 +173,7 @@ static int qsd_intent_interpret(const struct lu_env *env, rc = ldlm_cli_enqueue_fini(aa->aa_exp, req, &einfo, 0, &flags, aa->aa_lvb, sizeof(*(aa->aa_lvb)), - lockh, rc); + lockh, rc, false); if (rc < 0) { /* the lock has been destroyed, forget about the lock handle */ memset(lockh, 0, sizeof(*lockh));