[v8,0/5] md: protect md_thread with rcu

Message ID 20230523021017.3048783-1-yukuai1@huaweicloud.com
Headers
Series md: protect md_thread with rcu |

Message

Yu Kuai May 23, 2023, 2:10 a.m. UTC
  From: Yu Kuai <yukuai3@huawei.com>

Changes in v8:
 - fix that another unrelated patch is merged into this patchset
 - update commit message for patch 5
 - rebase on the top of another patch from me: [PATCH v3] md: fix duplicate filename for rdev

Changes in v7:
 - add missing changes for md-cluster
 - rebase for the latest md-next branch

Changes in v6:
 - remove first patch from v5, and use rcu_asign_pointer() directly from
 caller.
 - always use rcu_read_lock/unlock to protect mddev_set_timeout().

Changes in v5:
 - use rcu_dereference_protected() instead of rcu_access_pointer() where
 rcu_read_lock/unlock is not required.
 - add patch 4,5 to handle that bitmap timeout is set multiple times.

Changes in v4:
 - remove patch 2 from v3
 - fix sparse errors and warnings from v3, in order to do that, all access
 to md_thread need to be modified, patch 2-4 is splited to avoid a huge
 patch.

Changes in v3:
 - remove patch 3 from v2
 - use rcu instead of a new lock

Changes in v2:
 - fix a compile error for md-cluster in patch 2
 - replace spin_lock/unlock with spin_lock/unlock_irq in patch 5
 - don't wake up inside the new lock in md wakeup_thread in patch 5

Yu Kuai (5):
  md: factor out a helper to wake up md_thread directly
  dm-raid: remove useless checking in raid_message()
  md/bitmap: always wake up md_thread in timeout_store
  md/bitmap: factor out a helper to set timeout
  md: protect md_thread with rcu

 drivers/md/dm-raid.c      |  4 +-
 drivers/md/md-bitmap.c    | 43 +++++++++++--------
 drivers/md/md-cluster.c   | 17 +++++---
 drivers/md/md-multipath.c |  4 +-
 drivers/md/md.c           | 88 +++++++++++++++++++++------------------
 drivers/md/md.h           |  8 ++--
 drivers/md/raid1.c        |  7 ++--
 drivers/md/raid1.h        |  2 +-
 drivers/md/raid10.c       | 20 +++++----
 drivers/md/raid10.h       |  2 +-
 drivers/md/raid5-cache.c  | 22 ++++++----
 drivers/md/raid5.c        | 15 +++----
 drivers/md/raid5.h        |  2 +-
 13 files changed, 132 insertions(+), 102 deletions(-)
  

Comments

Song Liu May 23, 2023, 6:42 p.m. UTC | #1
On Mon, May 22, 2023 at 7:13 PM Yu Kuai <yukuai1@huaweicloud.com> wrote:
>
> From: Yu Kuai <yukuai3@huawei.com>
>
> Changes in v8:
>  - fix that another unrelated patch is merged into this patchset
>  - update commit message for patch 5
>  - rebase on the top of another patch from me: [PATCH v3] md: fix duplicate filename for rdev

Applied to md-next.

Thanks,
Song