From: James Simmons <jsimmons@infradead.org>
To: Andreas Dilger <adilger@whamcloud.com>,
Oleg Drokin <green@whamcloud.com>, NeilBrown <neilb@suse.de>
Cc: Lei Feng <flei@whamcloud.com>,
Lustre Development List <lustre-devel@lists.lustre.org>
Subject: [lustre-devel] [PATCH 12/15] lustre: ptlrpc: remove LASSERT in nrs_polices debugfs handler
Date: Mon, 8 Nov 2021 10:07:40 -0500 [thread overview]
Message-ID: <1636384063-13838-13-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1636384063-13838-1-git-send-email-jsimmons@infradead.org>
From: Lei Feng <flei@whamcloud.com>
It's not necessary to LASSERT() in nrs_polices debugfs handler.
CERROR() and returning error is good enough.
WC-bug-id: https://jira.whamcloud.com/browse/LU-14587
Lustre-commit: 9997f94d4b6ee335d ("LU-14587 ptlrpc: remove LASSERT in nrs_polices proc handler")
Signed-off-by: Lei Feng <flei@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45200
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
fs/lustre/ptlrpc/lproc_ptlrpc.c | 51 +++++++++++++++++++++++++++++++++--------
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/fs/lustre/ptlrpc/lproc_ptlrpc.c b/fs/lustre/ptlrpc/lproc_ptlrpc.c
index 0323291..b2daf1f 100644
--- a/fs/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/fs/lustre/ptlrpc/lproc_ptlrpc.c
@@ -570,6 +570,8 @@ static int ptlrpc_lprocfs_nrs_policies_seq_show(struct seq_file *m, void *n)
if (i == 0) {
memcpy(infos[pol_idx].pi_name, tmp.pi_name,
NRS_POL_NAME_MAX);
+ memcpy(infos[pol_idx].pi_arg, tmp.pi_arg,
+ sizeof(tmp.pi_arg));
memcpy(&infos[pol_idx].pi_state, &tmp.pi_state,
sizeof(tmp.pi_state));
infos[pol_idx].pi_fallback = tmp.pi_fallback;
@@ -578,17 +580,39 @@ static int ptlrpc_lprocfs_nrs_policies_seq_show(struct seq_file *m, void *n)
* sanity-check the values we get.
*/
} else {
- LASSERT(strncmp(infos[pol_idx].pi_name,
- tmp.pi_name,
- NRS_POL_NAME_MAX) == 0);
+ if (strncmp(infos[pol_idx].pi_name,
+ tmp.pi_name,
+ NRS_POL_NAME_MAX) != 0) {
+ spin_unlock(&nrs->nrs_lock);
+ rc = -EINVAL;
+ CERROR("%s: failed to check pi_name: rc = %d\n",
+ svc->srv_thread_name, rc);
+ goto unlock;
+ }
+ if (strncmp(infos[pol_idx].pi_arg,
+ tmp.pi_arg,
+ sizeof(tmp.pi_arg)) != 0) {
+ spin_unlock(&nrs->nrs_lock);
+ rc = -EINVAL;
+ CERROR("%s: failed to check pi_arg: rc = %d\n",
+ svc->srv_thread_name, rc);
+ goto unlock;
+ }
/**
- * Not asserting ptlrpc_nrs_pol_info::pi_state,
+ * Not checking ptlrpc_nrs_pol_info::pi_state,
* because it may be different between
* instances of the same policy in different
* service partitions.
*/
- LASSERT(infos[pol_idx].pi_fallback ==
- tmp.pi_fallback);
+
+ if (infos[pol_idx].pi_fallback !=
+ tmp.pi_fallback) {
+ spin_unlock(&nrs->nrs_lock);
+ rc = -EINVAL;
+ CERROR("%s: failed to check pi_fallback: rc = %d\n",
+ svc->srv_thread_name, rc);
+ goto unlock;
+ }
}
infos[pol_idx].pi_req_queued += tmp.pi_req_queued;
@@ -633,12 +657,18 @@ static int ptlrpc_lprocfs_nrs_policies_seq_show(struct seq_file *m, void *n)
!hp ? "\nregular_requests:" : "high_priority_requests:");
for (pol_idx = 0; pol_idx < num_pols; pol_idx++) {
- seq_printf(m, " - name: %s\n"
- " state: %s\n"
+ if (strlen(infos[pol_idx].pi_arg) > 0)
+ seq_printf(m, " - name: %s %s\n",
+ infos[pol_idx].pi_name,
+ infos[pol_idx].pi_arg);
+ else
+ seq_printf(m, " - name: %s\n",
+ infos[pol_idx].pi_name);
+
+ seq_printf(m, " state: %s\n"
" fallback: %s\n"
" queued: %-20d\n"
" active: %-20d\n\n",
- infos[pol_idx].pi_name,
nrs_state2str(infos[pol_idx].pi_state),
infos[pol_idx].pi_fallback ? "yes" : "no",
(int)infos[pol_idx].pi_req_queued,
@@ -655,8 +685,9 @@ static int ptlrpc_lprocfs_nrs_policies_seq_show(struct seq_file *m, void *n)
goto again;
}
- kfree(infos);
unlock:
+ kfree(infos);
+
mutex_unlock(&nrs_core.nrs_mutex);
return rc;
--
1.8.3.1
_______________________________________________
lustre-devel mailing list
lustre-devel@lists.lustre.org
http://lists.lustre.org/listinfo.cgi/lustre-devel-lustre.org
next prev parent reply other threads:[~2021-11-08 15:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 15:07 [lustre-devel] [PATCH 00/15] lustre: update to OpenSFS tree Nov 8, 2021 James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 01/15] lustre: sec: keep encryption context in xattr cache James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 02/15] lustre: mdc: add support for grant shrink James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 03/15] lnet: Fix reference leak in lnet_parse James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 04/15] lnet: socklnd: lock ksnc_tx_queue list processing James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 05/15] lustre: ptlrpc: align function names with param names James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 06/15] lnet: don't retry allocating router buffers James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 07/15] lustre: ptlrpc: recalc timer on EINPROGRESS reply James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 08/15] lustre: obdclass: add start time to stats files James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 09/15] lustre: dne: dir migrate in QOS mode James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 10/15] lustre: lov: fix error handling in lov_new_pool James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 11/15] lustre: vfs: set_nlink() is not race-safe James Simmons
2021-11-08 15:07 ` James Simmons [this message]
2021-11-08 15:07 ` [lustre-devel] [PATCH 13/15] lnet: socklnd: default conns_per_peer to 0 James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 14/15] lnet: don't use hops to determine the route state James Simmons
2021-11-08 15:07 ` [lustre-devel] [PATCH 15/15] lustre: lmv: update default LMV upon any change 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=1636384063-13838-13-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=adilger@whamcloud.com \
--cc=flei@whamcloud.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).