]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs: dlm: use WARN_ON_ONCE() instead of WARN_ON()
authorAlexander Aring <aahringo@redhat.com>
Thu, 27 Oct 2022 20:45:27 +0000 (16:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:18 +0000 (08:50 +0100)
[ Upstream commit 7e0408dd1c9d8da61f299524219c3e135d27e935 ]

To not get the console spammed about WARN_ON() of invalid states in the
dlm midcomms hot path handling we switch to WARN_ON_ONCE() to get it
only once that there might be an issue with the midcomms state handling.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Stable-dep-of: 557856c7140b ("fs: dlm: be sure to call dlm_send_queue_flush()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/dlm/midcomms.c

index 0477493706edba1f1cd35cb3e8fb4027de527945..b53d7a281be93623faec40244f93ebd870a08692 100644 (file)
@@ -469,7 +469,7 @@ static void dlm_pas_fin_ack_rcv(struct midcomms_node *node)
                spin_unlock(&node->state_lock);
                log_print("%s: unexpected state: %d\n",
                          __func__, node->state);
-               WARN_ON(1);
+               WARN_ON_ONCE(1);
                return;
        }
        spin_unlock(&node->state_lock);
@@ -542,13 +542,13 @@ static void dlm_midcomms_receive_buffer(union dlm_packet *p,
                                spin_unlock(&node->state_lock);
                                log_print("%s: unexpected state: %d\n",
                                          __func__, node->state);
-                               WARN_ON(1);
+                               WARN_ON_ONCE(1);
                                return;
                        }
                        spin_unlock(&node->state_lock);
                        break;
                default:
-                       WARN_ON(test_bit(DLM_NODE_FLAG_STOP_RX, &node->flags));
+                       WARN_ON_ONCE(test_bit(DLM_NODE_FLAG_STOP_RX, &node->flags));
                        dlm_receive_buffer_3_2_trace(seq, p);
                        dlm_receive_buffer(p, node->nodeid);
                        set_bit(DLM_NODE_ULP_DELIVERED, &node->flags);
@@ -764,7 +764,7 @@ static void dlm_midcomms_receive_buffer_3_2(union dlm_packet *p, int nodeid)
                        goto out;
                }
 
-               WARN_ON(test_bit(DLM_NODE_FLAG_STOP_RX, &node->flags));
+               WARN_ON_ONCE(test_bit(DLM_NODE_FLAG_STOP_RX, &node->flags));
                dlm_receive_buffer(p, nodeid);
                break;
        case DLM_OPTS:
@@ -1089,7 +1089,7 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len,
        }
 
        /* this is a bug, however we going on and hope it will be resolved */
-       WARN_ON(test_bit(DLM_NODE_FLAG_STOP_TX, &node->flags));
+       WARN_ON_ONCE(test_bit(DLM_NODE_FLAG_STOP_TX, &node->flags));
 
        mh = dlm_allocate_mhandle();
        if (!mh)
@@ -1121,7 +1121,7 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len,
                break;
        default:
                dlm_free_mhandle(mh);
-               WARN_ON(1);
+               WARN_ON_ONCE(1);
                goto err;
        }
 
@@ -1197,7 +1197,7 @@ void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh,
                break;
        default:
                srcu_read_unlock(&nodes_srcu, mh->idx);
-               WARN_ON(1);
+               WARN_ON_ONCE(1);
                break;
        }
 }
@@ -1254,7 +1254,7 @@ static void dlm_act_fin_ack_rcv(struct midcomms_node *node)
                spin_unlock(&node->state_lock);
                log_print("%s: unexpected state: %d\n",
                          __func__, node->state);
-               WARN_ON(1);
+               WARN_ON_ONCE(1);
                return;
        }
        spin_unlock(&node->state_lock);
@@ -1366,7 +1366,7 @@ static void midcomms_node_release(struct rcu_head *rcu)
 {
        struct midcomms_node *node = container_of(rcu, struct midcomms_node, rcu);
 
-       WARN_ON(atomic_read(&node->send_queue_cnt));
+       WARN_ON_ONCE(atomic_read(&node->send_queue_cnt));
        kfree(node);
 }