Skip to content

block: don't acquire .sysfs_lock before removing mq & iosched kobjects

Ming Lei linux-block 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 2 repliesIn review
  2. v35 patches 2 repliesSuperseded
  3. v26 patches 13 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch10 repliesSuperseded

Changes in v4 from the cover letter

- address comments from Bart
- update comments, add comments about releasing sysfs_lock in elevator_switch_mq
- fix a race in blk_register_queue by holding sysfs_lock for emitting KOBJ_ADD
- only the 5th patch is updated

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5block: Remove blk_mq_register_dev()block/blk-mq-sysfs.c include/linux/blk-mq.h+0 -120 replies
2/5block: don't hold q->sysfs_lock in elevator_init_mqblock/elevator.c+5 -90 replies
3/5blk-mq: don't hold q->sysfs_lock in blk_mq_map_swqueueblock/blk-mq.c+0 -70 replies
4/5block: add helper for checking if queue is registeredblock/blk-sysfs.c block/blk-wbt.c block/elevator.c +1 more+5 -40 replies
5/5block: split .sysfs_lock into two locksblock/blk-core.c block/blk-mq-sysfs.c block/blk-sysfs.c +3 more+84 -331 reply

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchBart Van Assche
1/5
2/5R-b
3/5R-b
4/5R-b
5/5R-b

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

Read the v4 thread

Cover letter [PATCH V4 0/5] block: don't acquire .sysfs_lock before removing mq & iosched kobjects

Hi,

The 1st 3 patches cleans up current uses on q->sysfs_lock.

The 4th patch adds one helper for checking if queue is registered.

The last patch splits .sysfs_lock into two locks: one is only for sync .store/.show from sysfs, the other one is for pretecting kobjects registering/unregistering. Meantime avoid to acquire .sysfs_lock when removing mq & iosched kobjects, so that the reported deadlock can be fixed.

V4:
- address comments from Bart
- update comments, add comments about releasing sysfs_lock in elevator_switch_mq
- fix a race in blk_register_queue by holding sysfs_lock for emitting KOBJ_ADD
- only the 5th patch is updated

V3:
- drop the 4th patch in V2, which is wrong, meantime not necesary for fixing this deadlock
- replace comment with one WARN_ON_ONCE() in patch 2
- add reviewed-by tag

V2:
- remove several uses on .sysfs_lock
- Remove blk_mq_register_dev()
- add one helper for checking queue registered
- split .sysfs_lock into two locks

Bart Van Assche (1):
block: Remove blk_mq_register_dev()

Ming Lei (4):
block: don't hold q->sysfs_lock in elevator_init_mq
blk-mq: don't hold q->sysfs_lock in blk_mq_map_swqueue
block: add helper for checking if queue is registered
block: split .sysfs_lock into two locks

 block/blk-core.c       |  1 +
 block/blk-mq-sysfs.c   | 23 ++++----------
 block/blk-mq.c         |  7 -----
 block/blk-sysfs.c      | 50 +++++++++++++++++------------
 block/blk-wbt.c        |  2 +-
 block/blk.h            |  2 +-
 block/elevator.c       | 71 +++++++++++++++++++++++++++++++-----------
 include/linux/blk-mq.h |  1 -
 include/linux/blkdev.h |  2 ++
 9 files changed, 94 insertions(+), 65 deletions(-)
Cc Christoph Hellwig <[email protected]>
Cc Hannes Reinecke <[email protected]>
Cc Greg KH <[email protected]>
Cc Mike Snitzer <[email protected]>
Cc Bart Van Assche <[email protected]>
Cc Damien Le Moal <[email protected]>
Signature · 1 line
2.20.1