Whamcloud - gitweb
LU-14587 ptlrpc: remove LASSERT in nrs_polices proc handler 68/45568/2
authorLei Feng <flei@whamcloud.com>
Tue, 12 Oct 2021 06:33:22 +0000 (14:33 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 17 Nov 2021 18:45:05 +0000 (18:45 +0000)
It's not necessary to LASSERT() in nrs_polices proc handler.
CERROR() and returning error is good enough.

Lustre-change: https://review.whamcloud.com/45200
Lustre-commit: 9997f94d4b6ee335d2bf86f94bd43464d5b8f061

Signed-off-by: Lei Feng <flei@whamcloud.com>
Test-Parameters: trivial
Change-Id: I09f06dc4ab90e49b2df66a9b47a74678c64cdd2f
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45568
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/ptlrpc/lproc_ptlrpc.c

index 546aa3c..659462a 100644 (file)
@@ -600,20 +600,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;