@@ -145,10 +145,10 @@ static struct init_tree_node {
145145 }
146146};
147147
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
152152};
153153
154154static const struct rhashtable_params rhash_fte = {
@@ -184,7 +184,7 @@ static void tree_init_node(struct fs_node *node,
184184 atomic_set (& node -> refcount , 1 );
185185 INIT_LIST_HEAD (& node -> list );
186186 INIT_LIST_HEAD (& node -> children );
187- mutex_init (& node -> lock );
187+ init_rwsem (& node -> lock );
188188 node -> remove_func = remove_func ;
189189 node -> active = false;
190190}
@@ -208,18 +208,18 @@ static void tree_get_node(struct fs_node *node)
208208}
209209
210210static void nested_lock_ref_node (struct fs_node * node ,
211- enum fs_i_mutex_lock_class class )
211+ enum fs_i_lock_class class )
212212{
213213 if (node ) {
214- mutex_lock_nested (& node -> lock , class );
214+ down_write_nested (& node -> lock , class );
215215 atomic_inc (& node -> refcount );
216216 }
217217}
218218
219219static void lock_ref_node (struct fs_node * node )
220220{
221221 if (node ) {
222- mutex_lock (& node -> lock );
222+ down_write (& node -> lock );
223223 atomic_inc (& node -> refcount );
224224 }
225225}
@@ -228,7 +228,7 @@ static void unlock_ref_node(struct fs_node *node)
228228{
229229 if (node ) {
230230 atomic_dec (& node -> refcount );
231- mutex_unlock (& node -> lock );
231+ up_write (& node -> lock );
232232 }
233233}
234234
@@ -1376,7 +1376,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
13761376 int old_action ;
13771377 int ret ;
13781378
1379- nested_lock_ref_node (& fte -> node , FS_MUTEX_CHILD );
1379+ nested_lock_ref_node (& fte -> node , FS_LOCK_CHILD );
13801380 ret = check_conflicting_ftes (fte , flow_act );
13811381 if (ret ) {
13821382 handle = ERR_PTR (ret );
@@ -1400,7 +1400,7 @@ static struct mlx5_flow_handle *add_rule_fg(struct mlx5_flow_group *fg,
14001400 fte = alloc_insert_fte (fg , match_value , flow_act );
14011401 if (IS_ERR (fte ))
14021402 return (void * )fte ;
1403- nested_lock_ref_node (& fte -> node , FS_MUTEX_CHILD );
1403+ nested_lock_ref_node (& fte -> node , FS_LOCK_CHILD );
14041404 handle = add_rule_fte (fte , fg , dest , dest_num , false);
14051405 if (IS_ERR (handle )) {
14061406 unlock_ref_node (& fte -> node );
@@ -1548,7 +1548,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
15481548 struct fs_fte * fte ;
15491549
15501550 g = iter -> g ;
1551- nested_lock_ref_node (& g -> node , FS_MUTEX_PARENT );
1551+ nested_lock_ref_node (& g -> node , FS_LOCK_PARENT );
15521552 fte = rhashtable_lookup_fast (& g -> ftes_hash , spec -> match_value ,
15531553 rhash_fte );
15541554 if (fte ) {
@@ -1566,7 +1566,7 @@ try_add_to_existing_fg(struct mlx5_flow_table *ft,
15661566 list_for_each_entry (iter , & match_head .list , list ) {
15671567 g = iter -> g ;
15681568
1569- nested_lock_ref_node (& g -> node , FS_MUTEX_PARENT );
1569+ nested_lock_ref_node (& g -> node , FS_LOCK_PARENT );
15701570 rule = add_rule_fg (g , spec -> match_value ,
15711571 flow_act , dest , dest_num , NULL );
15721572 if (!IS_ERR (rule ) || PTR_ERR (rule ) != - ENOSPC ) {
@@ -1605,7 +1605,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
16051605 return ERR_PTR (- EINVAL );
16061606 }
16071607
1608- nested_lock_ref_node (& ft -> node , FS_MUTEX_GRANDPARENT );
1608+ nested_lock_ref_node (& ft -> node , FS_LOCK_GRANDPARENT );
16091609 rule = try_add_to_existing_fg (ft , spec , flow_act , dest , dest_num );
16101610 if (!IS_ERR (rule ) || PTR_ERR (rule ) != - ENOENT )
16111611 goto unlock ;
0 commit comments