@@ -1555,16 +1555,16 @@ struct match_list_head {
1555
1555
struct match_list first ;
1556
1556
};
1557
1557
1558
- static void free_match_list (struct match_list_head * head )
1558
+ static void free_match_list (struct match_list_head * head , bool ft_locked )
1559
1559
{
1560
1560
if (!list_empty (& head -> list )) {
1561
1561
struct match_list * iter , * match_tmp ;
1562
1562
1563
1563
list_del (& head -> first .list );
1564
- tree_put_node (& head -> first .g -> node , false );
1564
+ tree_put_node (& head -> first .g -> node , ft_locked );
1565
1565
list_for_each_entry_safe (iter , match_tmp , & head -> list ,
1566
1566
list ) {
1567
- tree_put_node (& iter -> g -> node , false );
1567
+ tree_put_node (& iter -> g -> node , ft_locked );
1568
1568
list_del (& iter -> list );
1569
1569
kfree (iter );
1570
1570
}
@@ -1573,7 +1573,8 @@ static void free_match_list(struct match_list_head *head)
1573
1573
1574
1574
static int build_match_list (struct match_list_head * match_head ,
1575
1575
struct mlx5_flow_table * ft ,
1576
- const struct mlx5_flow_spec * spec )
1576
+ const struct mlx5_flow_spec * spec ,
1577
+ bool ft_locked )
1577
1578
{
1578
1579
struct rhlist_head * tmp , * list ;
1579
1580
struct mlx5_flow_group * g ;
@@ -1598,7 +1599,7 @@ static int build_match_list(struct match_list_head *match_head,
1598
1599
1599
1600
curr_match = kmalloc (sizeof (* curr_match ), GFP_ATOMIC );
1600
1601
if (!curr_match ) {
1601
- free_match_list (match_head );
1602
+ free_match_list (match_head , ft_locked );
1602
1603
err = - ENOMEM ;
1603
1604
goto out ;
1604
1605
}
@@ -1778,7 +1779,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
1778
1779
version = atomic_read (& ft -> node .version );
1779
1780
1780
1781
/* Collect all fgs which has a matching match_criteria */
1781
- err = build_match_list (& match_head , ft , spec );
1782
+ err = build_match_list (& match_head , ft , spec , take_write );
1782
1783
if (err ) {
1783
1784
if (take_write )
1784
1785
up_write_ref_node (& ft -> node , false);
@@ -1792,7 +1793,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
1792
1793
1793
1794
rule = try_add_to_existing_fg (ft , & match_head .list , spec , flow_act , dest ,
1794
1795
dest_num , version );
1795
- free_match_list (& match_head );
1796
+ free_match_list (& match_head , take_write );
1796
1797
if (!IS_ERR (rule ) ||
1797
1798
(PTR_ERR (rule ) != - ENOENT && PTR_ERR (rule ) != - EAGAIN )) {
1798
1799
if (take_write )
0 commit comments