lustre-devel-lustre.org archive mirror
 help / color / mirror / Atom feed
From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
	Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Andriy Skulysh <c17819@cray.com>,
	Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 14/19] lustre: llite: skip request slot for lmv_revalidate_slaves()
Date: Sun, 28 Nov 2021 18:27:49 -0500	[thread overview]
Message-ID: <1638142074-5945-15-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1638142074-5945-1-git-send-email-jsimmons@infradead.org>

From: Andriy Skulysh <c17819@cray.com>

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.

HPE-bug-id: LUS-8416
WC-bug-id: https://jira.whamcloud.com/browse/LU-15121
Lustre-commit: 7e781c605c4189ea1 ("LU-15121 llite: skip request slot for lmv_revalidate_slaves()")
Signed-off-by: Andriy Skulysh <c17819@cray.com>
Reviewed-on: https://review.whamcloud.com/45275
Reviewed-by: Vitaly Fertman <c17818@cray.com>
Reviewed-by: Alexander Zarochentsev <c17826@cray.com>
Reviewed-by: Vitaly Fertman <vitaly.fertman@hpe.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/include/lustre_dlm.h |  7 +++++--
 fs/lustre/include/obd.h        |  1 +
 fs/lustre/ldlm/ldlm_request.c  | 18 +++++++++++-------
 fs/lustre/llite/statahead.c    |  1 +
 fs/lustre/lmv/lmv_intent.c     |  2 ++
 fs/lustre/mdc/mdc_dev.c        |  3 ++-
 fs/lustre/mdc/mdc_locks.c      |  5 +++--
 fs/lustre/osc/osc_request.c    |  2 +-
 8 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/fs/lustre/include/lustre_dlm.h b/fs/lustre/include/lustre_dlm.h
index 1fc199b..a2fe9676 100644
--- a/fs/lustre/include/lustre_dlm.h
+++ b/fs/lustre/include/lustre_dlm.h
@@ -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);
diff --git a/fs/lustre/include/obd.h b/fs/lustre/include/obd.h
index 27acd33..58a5803 100644
--- a/fs/lustre/include/obd.h
+++ b/fs/lustre/include/obd.h
@@ -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 {
diff --git a/fs/lustre/ldlm/ldlm_request.c b/fs/lustre/ldlm/ldlm_request.c
index 746c45b..44e1ec2 100644
--- a/fs/lustre/ldlm/ldlm_request.c
+++ b/fs/lustre/ldlm/ldlm_request.c
@@ -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
diff --git a/fs/lustre/llite/statahead.c b/fs/lustre/llite/statahead.c
index 4806e99..39ffb9d 100644
--- a/fs/lustre/llite/statahead.c
+++ b/fs/lustre/llite/statahead.c
@@ -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;
 }
diff --git a/fs/lustre/lmv/lmv_intent.c b/fs/lustre/lmv/lmv_intent.c
index 93da2b3..906ca16 100644
--- a/fs/lustre/lmv/lmv_intent.c
+++ b/fs/lustre/lmv/lmv_intent.c
@@ -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) {
diff --git a/fs/lustre/mdc/mdc_dev.c b/fs/lustre/mdc/mdc_dev.c
index b2f60ea..0b1d257 100644
--- a/fs/lustre/mdc/mdc_dev.c
+++ b/fs/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,
@@ -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);
diff --git a/fs/lustre/mdc/mdc_locks.c b/fs/lustre/mdc/mdc_locks.c
index 4135c3a..66f0039 100644
--- a/fs/lustre/mdc/mdc_locks.c
+++ b/fs/lustre/mdc/mdc_locks.c
@@ -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);
diff --git a/fs/lustre/osc/osc_request.c b/fs/lustre/osc/osc_request.c
index cf79808..e065eab 100644
--- a/fs/lustre/osc/osc_request.c
+++ b/fs/lustre/osc/osc_request.c
@@ -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);
-- 
1.8.3.1

_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org

  parent reply	other threads:[~2021-11-28 23:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-28 23:27 [lustre-devel] [PATCH 00/19] lustre: update to OpenSFS tree Nov 28, 2021 James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 01/19] lnet: fix delay rule crash James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 02/19] lnet: change tp_nid to 16byte in lnet_test_peer James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 03/19] lnet: extend preferred nids in struct lnet_peer_ni James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 04/19] lnet: switch to large lnet_processid for matching James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 05/19] lnet: libcfs: add timeout to cfs_race() to fix race James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 06/19] lustre: llite: tighten condition for fault not drop mmap_sem James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 07/19] lnet: o2iblnd: map_on_demand not needed for frag interop James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 08/19] lnet: o2iblnd: Fix logic for unaligned transfer James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 09/19] lnet: Reset ni_ping_count only on receive James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 10/19] lustre: ptlrpc: fix timeout after spurious wakeup James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 11/19] lnet: Fail peer add for existing gw peer James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 12/19] lustre: ptlrpc: remove bogus LASSERT James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 13/19] lustre: quota: optimize capability check for root squash James Simmons
2021-11-28 23:27 ` James Simmons [this message]
2021-11-28 23:27 ` [lustre-devel] [PATCH 15/19] lnet: set eth routes needed for multi rail James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 16/19] lustre: llite: Do not count tiny write twice James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 17/19] lustre: llite: mend the trunc_sem_up_write() James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 18/19] lnet: Netlink improvements James Simmons
2021-11-28 23:27 ` [lustre-devel] [PATCH 19/19] lnet: libcfs: separate daemon_list from cfs_trace_data James Simmons

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1638142074-5945-15-git-send-email-jsimmons@infradead.org \
    --to=jsimmons@infradead.org \
    --cc=adilger@whamcloud.com \
    --cc=c17819@cray.com \
    --cc=green@whamcloud.com \
    --cc=lustre-devel@lists.lustre.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).