]> git.itanic.dy.fi Git - linux-stable/commitdiff
net/mlx5: DR, Warn on failure to destroy objects due to refcount
authorYevgeny Kliteynik <kliteyn@nvidia.com>
Wed, 29 Sep 2021 12:36:32 +0000 (15:36 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 31 Dec 2021 08:17:20 +0000 (00:17 -0800)
Add WARN_ON_ONCE on refcount checks in SW steering object destructors

Signed-off-by: Paul Blakey <paulb@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_domain.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_matcher.c
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c

index 07936841ce99b15fbc3b665f5a863e5738322f02..f0faf04536d3a4c8a6eded74ceb09efddcd66f53 100644 (file)
@@ -1792,7 +1792,7 @@ mlx5dr_action_create_dest_vport(struct mlx5dr_domain *dmn,
 
 int mlx5dr_action_destroy(struct mlx5dr_action *action)
 {
-       if (refcount_read(&action->refcount) > 1)
+       if (WARN_ON_ONCE(refcount_read(&action->refcount) > 1))
                return -EBUSY;
 
        switch (action->action_type) {
index 97a41b2b36e5f473923f1781a7b339271a7f0988..5fa7f9d6d8b95c1c96397627c149793e4210594a 100644 (file)
@@ -431,7 +431,7 @@ int mlx5dr_domain_sync(struct mlx5dr_domain *dmn, u32 flags)
 
 int mlx5dr_domain_destroy(struct mlx5dr_domain *dmn)
 {
-       if (refcount_read(&dmn->refcount) > 1)
+       if (WARN_ON_ONCE(refcount_read(&dmn->refcount) > 1))
                return -EBUSY;
 
        /* make sure resources are not used by the hardware */
index 88288c02d6ead572c30250aaad59281900100c37..12ebb7adea4d69f46e9c14752f05f4d6680afe7d 100644 (file)
@@ -1069,7 +1069,7 @@ int mlx5dr_matcher_destroy(struct mlx5dr_matcher *matcher)
 {
        struct mlx5dr_table *tbl = matcher->tbl;
 
-       if (refcount_read(&matcher->refcount) > 1)
+       if (WARN_ON_ONCE(refcount_read(&matcher->refcount) > 1))
                return -EBUSY;
 
        mlx5dr_domain_lock(tbl->dmn);
index 241ee49a24ba52ee8e4569f24a47dd6ad7d6bdb6..1d6b43a52c58be298e8843857d1f6d55daa11961 100644 (file)
@@ -283,7 +283,7 @@ int mlx5dr_table_destroy(struct mlx5dr_table *tbl)
 {
        int ret;
 
-       if (refcount_read(&tbl->refcount) > 1)
+       if (WARN_ON_ONCE(refcount_read(&tbl->refcount) > 1))
                return -EBUSY;
 
        mlx5dr_dbg_tbl_del(tbl);