From: Lei Feng Date: Tue, 12 Oct 2021 06:33:22 +0000 (+0800) Subject: LU-14587 ptlrpc: remove LASSERT in nrs_polices proc handler X-Git-Tag: 2.14.56~123 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9997f94d4b6ee335d2bf86f94bd43464d5b8f061 LU-14587 ptlrpc: remove LASSERT in nrs_polices proc handler It's not necessary to LASSERT() in nrs_polices proc handler. CERROR() and returning error is good enough. Signed-off-by: Lei Feng Test-Parameters: trivial Change-Id: I09f06dc4ab90e49b2df66a9b47a74678c64cdd2f Reviewed-on: https://review.whamcloud.com/45200 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: Li Xi Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 23516e8..7141d97 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -597,20 +597,39 @@ again: * sanity-check the values we get. */ } else { - LASSERT(strncmp(infos[pol_idx].pi_name, - tmp.pi_name, - NRS_POL_NAME_MAX) == 0); - LASSERT(strncmp(infos[pol_idx].pi_arg, - tmp.pi_arg, - sizeof(tmp.pi_arg)) == 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(out, rc); + } + 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(out, rc); + } /** - * 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(out, rc); + } } infos[pol_idx].pi_req_queued += tmp.pi_req_queued;