@@ -145,10 +145,10 @@ static struct init_tree_node {
145
145
}
146
146
};
147
147
148
- enum fs_i_mutex_lock_class {
149
- FS_MUTEX_GRANDPARENT ,
150
- FS_MUTEX_PARENT ,
151
- FS_MUTEX_CHILD
148
+ enum fs_i_lock_class {
149
+ FS_LOCK_GRANDPARENT ,
150
+ FS_LOCK_PARENT ,
151
+ FS_LOCK_CHILD
152
152
};
153
153
154
154
static const struct rhashtable_params rhash_fte = {
@@ -184,7 +184,7 @@ static void tree_init_node(struct fs_node *node,
184
184
atomic_set (& node -> refcount , 1 );
185
185
INIT_LIST_HEAD (& node -> list );
186
186
INIT_LIST_HEAD (& node -> children );
187
- mutex_init (& node -> lock );
187
+ init_rwsem (& node -> lock );
188
188
node -> remove_func = remove_func ;
189
189
node -> active = false;
190
190
}
@@ -208,18 +208,18 @@ static void tree_get_node(struct fs_node *node)
208
208
}
209
209
210
210
static void nested_lock_ref_node (struct fs_node * node ,
211
- enum fs_i_mutex_lock_class class )
211
+ enum fs_i_lock_class class )
212
212
{
213
213
if (node ) {
214
- mutex_lock_nested (& node -> lock , class );
214
+ down_write_nested (& node -> lock , class );
215
215
atomic_inc (& node -> refcount );
216
216
}
217
217
}
218
218
219
219
static void lock_ref_node (struct fs_node * node )
220
220
{
221
221
if (node ) {
222
- mutex_lock (& node -> lock );
222
+ down_write (& node -> lock );
223
223
atomic_inc (& node -> refcount );
224
224
}
225
225
}
@@ -228,7 +228,7 @@ static void unlock_ref_node(struct fs_node *node)
228
228
{
229
229
if (node ) {
230
230
atomic_dec (& node -> refcount );
231
- mutex_unlock (& node -> lock );
231
+ up_write (& node -> lock );
232
232
}
233
233
}
234
234
@@ -1376,7 +1376,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
1376
1376
int old_action ;
1377
1377
int ret ;
1378
1378
1379
- nested_lock_ref_node (& fte -> node , FS_MUTEX_CHILD );
1379
+ nested_lock_ref_node (& fte -> node , FS_LOCK_CHILD );
1380
1380
ret = check_conflicting_ftes (fte , flow_act );
1381
1381
if (ret ) {
1382
1382
handle = ERR_PTR (ret );
@@ -1400,7 +1400,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
1400
1400
fte = alloc_insert_fte (fg , match_value , flow_act );
1401
1401
if (IS_ERR (fte ))
1402
1402
return (void * )fte ;
1403
- nested_lock_ref_node (& fte -> node , FS_MUTEX_CHILD );
1403
+ nested_lock_ref_node (& fte -> node , FS_LOCK_CHILD );
1404
1404
handle = add_rule_fte (fte , fg , dest , dest_num , false);
1405
1405
if (IS_ERR (handle )) {
1406
1406
unlock_ref_node (& fte -> node );
@@ -1548,7 +1548,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
1548
1548
struct fs_fte * fte ;
1549
1549
1550
1550
g = iter -> g ;
1551
- nested_lock_ref_node (& g -> node , FS_MUTEX_PARENT );
1551
+ nested_lock_ref_node (& g -> node , FS_LOCK_PARENT );
1552
1552
fte = rhashtable_lookup_fast (& g -> ftes_hash , spec -> match_value ,
1553
1553
rhash_fte );
1554
1554
if (fte ) {
@@ -1566,7 +1566,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
1566
1566
list_for_each_entry (iter , & match_head .list , list ) {
1567
1567
g = iter -> g ;
1568
1568
1569
- nested_lock_ref_node (& g -> node , FS_MUTEX_PARENT );
1569
+ nested_lock_ref_node (& g -> node , FS_LOCK_PARENT );
1570
1570
rule = add_rule_fg (g , spec -> match_value ,
1571
1571
flow_act , dest , dest_num , NULL );
1572
1572
if (!IS_ERR (rule ) || PTR_ERR (rule ) != - ENOSPC ) {
@@ -1605,7 +1605,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
1605
1605
return ERR_PTR (- EINVAL );
1606
1606
}
1607
1607
1608
- nested_lock_ref_node (& ft -> node , FS_MUTEX_GRANDPARENT );
1608
+ nested_lock_ref_node (& ft -> node , FS_LOCK_GRANDPARENT );
1609
1609
rule = try_add_to_existing_fg (ft , spec , flow_act , dest , dest_num );
1610
1610
if (!IS_ERR (rule ) || PTR_ERR (rule ) != - ENOENT )
1611
1611
goto unlock ;
0 commit comments