Skip to content

rds: use RCU between work-enqueue and connection teardown

Sowmini Varadhan netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2rds: Use atomic flag to track connections being destroyednet/rds/connection.c net/rds/rds.h net/rds/tcp_connect.c+7 -60 replies
2/2rds: use RCU to synchronize work-enqueue with connection teardownnet/rds/cong.c net/rds/connection.c net/rds/send.c +3 more+81 -200 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchSantosh Shilimkar
1/2A-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH net-next 0/2] rds: use RCU between work-enqueue and connection teardown

This patchset follows up on the root-cause mentioned in
https://www.spinics.net/lists/netdev/msg472849.html

Patch1 implements some code refactoring that was suggeseted as an enhancement in http://patchwork.ozlabs.org/patch/843157/
It replaces the c_destroy_in_prog bit in rds_connection with an atomically managed flag in rds_conn_path.

Patch2 builds on Patch1 and uses RCU to make sure that work is only enqueued if the connection destroy is not already in progress: the test-flag-and-enqueue is done under rcu_read_lock, while destroy first sets the flag, uses synchronize_rcu to wait for existing reader threads to complete, and then starts all the work-cancellation.

Since I have not been able to reproduce the original stack traces reported by syszbot, and these are fixes for a race condition that are based on code-inspection I am not marking these as reported-by at this time.

Sowmini Varadhan (2):
rds: Use atomic flag to track connections being destroyed
rds: Ensure that send/recv/reconnect work cannot be requeued from
softirq or proc context

 net/rds/cong.c        |   10 +++++++---
 net/rds/connection.c  |   24 +++++++++++++++++++-----
 net/rds/rds.h         |    4 ++--
 net/rds/send.c        |   37 ++++++++++++++++++++++++++++++++-----
 net/rds/tcp_connect.c |    2 +-
 net/rds/tcp_recv.c    |    8 ++++++--
 net/rds/tcp_send.c    |    5 ++++-
 net/rds/threads.c     |   20 +++++++++++++++-----
 8 files changed, 86 insertions(+), 24 deletions(-)