|
1 | 1 | /* |
2 | 2 | * (C) Copyright 2016-2024 Intel Corporation. |
3 | | - * (C) Copyright 2025 Hewlett Packard Enterprise Development LP |
| 3 | + * (C) Copyright 2025-2026 Hewlett Packard Enterprise Development LP |
4 | 4 | * |
5 | 5 | * SPDX-License-Identifier: BSD-2-Clause-Patent |
6 | 6 | */ |
@@ -790,8 +790,13 @@ crt_corpc_req_hdlr(struct crt_rpc_priv *rpc_priv) |
790 | 790 | opc_info = rpc_priv->crp_opc_info; |
791 | 791 | co_ops = opc_info->coi_co_ops; |
792 | 792 |
|
793 | | - if (rpc_priv->crp_fail_hlc) |
794 | | - D_GOTO(forward_done, rc = -DER_HLC_SYNC); |
| 793 | + if (rpc_priv->crp_fail_hlc) { |
| 794 | + rc = -DER_HLC_SYNC; |
| 795 | + RPC_ERROR(rpc_priv, "crp_fail_hlc (group %s) failed: " DF_RC "\n", |
| 796 | + co_info->co_grp_priv->gp_pub.cg_grpid, DP_RC(rc)); |
| 797 | + crt_corpc_fail_parent_rpc(rpc_priv, rc); |
| 798 | + D_GOTO(forward_done, rc); |
| 799 | + } |
795 | 800 |
|
796 | 801 | /* Invoke pre-forward callback first if it is registered */ |
797 | 802 | if (co_ops && co_ops->co_pre_forward) { |
@@ -908,20 +913,28 @@ crt_corpc_req_hdlr(struct crt_rpc_priv *rpc_priv) |
908 | 913 | } |
909 | 914 |
|
910 | 915 | forward_done: |
911 | | - if (rc != 0 && rpc_priv->crp_flags & CRT_RPC_FLAG_CO_FAILOUT) |
912 | | - co_failout = true; |
| 916 | + if (rc != 0) { |
| 917 | + /* reset rc to 0 as it already failed the parent/child RPC and |
| 918 | + * will be replied/completed by crt_corpc_complete(). |
| 919 | + */ |
| 920 | + rc = 0; |
| 921 | + if (rpc_priv->crp_flags & CRT_RPC_FLAG_CO_FAILOUT) |
| 922 | + co_failout = true; |
| 923 | + } |
913 | 924 |
|
914 | | - /* NOOP bcast (no child and root excluded) */ |
915 | | - if (co_info->co_child_num == 0 && (co_info->co_root_excluded || co_failout)) |
916 | | - crt_corpc_complete(rpc_priv); |
| 925 | + /* need not call local RPC handler */ |
| 926 | + if (co_info->co_root_excluded || co_failout) { |
| 927 | + /* NOOP bcast (no child and root excluded) */ |
| 928 | + if (co_info->co_child_num == 0) |
| 929 | + crt_corpc_complete(rpc_priv); |
917 | 930 |
|
918 | | - if (co_info->co_root_excluded == 1 || co_failout) { |
919 | | - if (co_info->co_grp_priv->gp_self == co_info->co_root) { |
920 | | - /* don't return error for root to avoid RPC_DECREF in |
921 | | - * fail case in crt_req_send. |
922 | | - */ |
923 | | - rc = 0; |
924 | | - } |
| 931 | + /* Corresponding the initial ref 1 in crt_rpc_handler_common() -> |
| 932 | + * crt_rpc_priv_init(rpc_priv, crt_ctx, true). |
| 933 | + * That ref commonly will be released by crt_rpc_common_hdlr() -> crt_handle_rpc(), |
| 934 | + * here as will not call crt_rpc_common_hdlr() so drop it explicitly. |
| 935 | + */ |
| 936 | + if (rpc_priv->crp_srv) |
| 937 | + RPC_DECREF(rpc_priv); |
925 | 938 | D_GOTO(out, rc); |
926 | 939 | } |
927 | 940 |
|
|
0 commit comments