@@ -1582,16 +1582,16 @@ struct match_list_head {
1582
1582
struct match_list first ;
1583
1583
};
1584
1584
1585
- static void free_match_list (struct match_list_head * head )
1585
+ static void free_match_list (struct match_list_head * head , bool ft_locked )
1586
1586
{
1587
1587
if (!list_empty (& head -> list )) {
1588
1588
struct match_list * iter , * match_tmp ;
1589
1589
1590
1590
list_del (& head -> first .list );
1591
- tree_put_node (& head -> first .g -> node , false );
1591
+ tree_put_node (& head -> first .g -> node , ft_locked );
1592
1592
list_for_each_entry_safe (iter , match_tmp , & head -> list ,
1593
1593
list ) {
1594
- tree_put_node (& iter -> g -> node , false );
1594
+ tree_put_node (& iter -> g -> node , ft_locked );
1595
1595
list_del (& iter -> list );
1596
1596
kfree (iter );
1597
1597
}
@@ -1600,7 +1600,8 @@ static void free_match_list(struct match_list_head *head)
1600
1600
1601
1601
static int build_match_list (struct match_list_head * match_head ,
1602
1602
struct mlx5_flow_table * ft ,
1603
- const struct mlx5_flow_spec * spec )
1603
+ const struct mlx5_flow_spec * spec ,
1604
+ bool ft_locked )
1604
1605
{
1605
1606
struct rhlist_head * tmp , * list ;
1606
1607
struct mlx5_flow_group * g ;
@@ -1625,7 +1626,7 @@ static int build_match_list(struct match_list_head *match_head,
1625
1626
1626
1627
curr_match = kmalloc (sizeof (* curr_match ), GFP_ATOMIC );
1627
1628
if (!curr_match ) {
1628
- free_match_list (match_head );
1629
+ free_match_list (match_head , ft_locked );
1629
1630
err = - ENOMEM ;
1630
1631
goto out ;
1631
1632
}
@@ -1805,7 +1806,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
1805
1806
version = atomic_read (& ft -> node .version );
1806
1807
1807
1808
/* Collect all fgs which has a matching match_criteria */
1808
- err = build_match_list (& match_head , ft , spec );
1809
+ err = build_match_list (& match_head , ft , spec , take_write );
1809
1810
if (err ) {
1810
1811
if (take_write )
1811
1812
up_write_ref_node (& ft -> node , false);
@@ -1819,7 +1820,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
1819
1820
1820
1821
rule = try_add_to_existing_fg (ft , & match_head .list , spec , flow_act , dest ,
1821
1822
dest_num , version );
1822
- free_match_list (& match_head );
1823
+ free_match_list (& match_head , take_write );
1823
1824
if (!IS_ERR (rule ) ||
1824
1825
(PTR_ERR (rule ) != - ENOENT && PTR_ERR (rule ) != - EAGAIN )) {
1825
1826
if (take_write )
0 commit comments