]> asedeno.scripts.mit.edu Git - linux.git/commit
net: sched: protect block offload-related fields with rw_semaphore
authorVlad Buslov <vladbu@mellanox.com>
Mon, 26 Aug 2019 13:44:57 +0000 (16:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Aug 2019 21:17:43 +0000 (14:17 -0700)
commit4f8116c85057239ff37519debdd5d45b38ad8130
tree35d4263c8dcf2addf88801cf9e43e49426f1cad7
parent0846e1616f0f3365cea732e82e2383932fe644e5
net: sched: protect block offload-related fields with rw_semaphore

In order to remove dependency on rtnl lock, extend tcf_block with 'cb_lock'
rwsem and use it to protect flow_block->cb_list and related counters from
concurrent modification. The lock is taken in read mode for read-only
traversal of cb_list in tc_setup_cb_call() and write mode in all other
cases. This approach ensures that:

- cb_list is not changed concurrently while filters is being offloaded on
  block.

- block->nooffloaddevcnt is checked while holding the lock in read mode,
  but is only changed by bind/unbind code when holding the cb_lock in write
  mode to prevent concurrent modification.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sch_generic.h
net/sched/cls_api.c