Skip to content

Commit da65ad1

Browse files
sashalevindavem330
authored andcommitted
net: allow sleeping when modifying store_rps_map
Commit 10e4ea7 ("net: Fix race condition in store_rps_map") has moved the manipulation of the rps_needed jump label under a spinlock. Since changing the state of a jump label may sleep this is incorrect and causes warnings during runtime. Make rps_map_lock a mutex to allow sleeping under it. Fixes: 10e4ea7 ("net: Fix race condition in store_rps_map") Signed-off-by: Sasha Levin <[email protected]> Acked-by: Tom Herbert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 968d7cb commit da65ad1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

net/core/net-sysfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue,
689689
struct rps_map *old_map, *map;
690690
cpumask_var_t mask;
691691
int err, cpu, i;
692-
static DEFINE_SPINLOCK(rps_map_lock);
692+
static DEFINE_MUTEX(rps_map_mutex);
693693

694694
if (!capable(CAP_NET_ADMIN))
695695
return -EPERM;
@@ -722,17 +722,17 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue,
722722
map = NULL;
723723
}
724724

725-
spin_lock(&rps_map_lock);
725+
mutex_lock(&rps_map_mutex);
726726
old_map = rcu_dereference_protected(queue->rps_map,
727-
lockdep_is_held(&rps_map_lock));
727+
mutex_is_locked(&rps_map_mutex));
728728
rcu_assign_pointer(queue->rps_map, map);
729729

730730
if (map)
731731
static_key_slow_inc(&rps_needed);
732732
if (old_map)
733733
static_key_slow_dec(&rps_needed);
734734

735-
spin_unlock(&rps_map_lock);
735+
mutex_unlock(&rps_map_mutex);
736736

737737
if (old_map)
738738
kfree_rcu(old_map, rcu);

0 commit comments

Comments
 (0)