Skip to content

Make all concurrent queue flag manipulations safe

Bart Van Assche linux-block 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest11 patches 3 repliesIn review
  2. v111 patches 25 repliesSuperseded

Changes in v2 from the cover letter

- Restored one test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags) call to avoid introducing a slowdown in the polling hot path.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11block: Reorder the queue flag manipulation function definitionsinclude/linux/blkdev.h+11 -110 replies
2/11block: Use the queue_flag_*() functions instead of open-coding theseblock/blk-core.c block/blk-mq.c block/blk-settings.c +1 more+7 -70 replies
3/11block: Introduce blk_queue_flag_{set,clear,test_and_{set,clear}}()block/blk-core.c block/blk-mq.c block/blk-settings.c +3 more+93 -490 replies
4/11block: Protect queue flag changes with the queue lockblock/blk-mq.c block/blk-stat.c+4 -41 reply
5/11mtip32xx: Use the blk_queue_flag_*() functionsdrivers/block/mtip32xx/mtip32xx.c+4 -40 replies
6/11bcache: Use the blk_queue_flag_{set,clear}() functionsdrivers/md/bcache/super.c+3 -30 replies
7/11iscsi: Use blk_queue_flag_set()drivers/scsi/iscsi_tcp.c+1 -10 replies
8/11target/tcm_loop: Use blk_queue_flag_set()drivers/target/loopback/tcm_loop.c+1 -10 replies
9/11block: Use blk_queue_flag_*() in drivers instead of queue_flag_*()block/bsg-lib.c drivers/block/drbd/drbd_nl.c drivers/block/loop.c +35 more+89 -891 reply
10/11block: Complain if queue_flag_(set|clear)_unlocked() is abusedinclude/linux/blkdev.h+6 -00 replies
11/11block: Move the queue_flag_*() functions from a public into a private header fileblock/blk.h include/linux/blkdev.h+69 -690 replies

Reviews trailers per patch

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

PatchJohannes ThumshirnMartin K. PetersenMichael Lyle
1/11R-b R-b
2/11R-b R-b
3/11R-b R-b
4/11R-b R-b
5/11R-b R-b
6/11R-b R-b R-b
7/11R-b A-b
8/11R-b R-b
9/11R-b R-b A-b
10/11R-b R-b
11/11R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/11] Make all concurrent queue flag manipulations safe

Hello Jens,

As you probably know there is considerable confusion in the block layer core and in block drivers about how to protect queue flag changes against concurrent modifications. Some code protects these changes with the queue lock, other code uses atomic operations and some code does not protect queue flag changes against concurrent changes at all. Hence this patch series that protects all queue flag changes consistently with the queue lock and that removes functions that are not safe in a concurrent context from the public block layer header files.

Please consider these patches for kernel v4.17.

Note: it may be a good idea to postpone patch 11 until after the kernel v4.17 merge window to avoid merge conflicts.

Thanks,

Bart.

Changes compared to v1:
- Restored one test_bit(QUEUE_FLAG_POLL_STATS, &q->queue_flags) call to avoid introducing a slowdown in the polling hot path.

Bart Van Assche (11):
block: Reorder the queue flag manipulation function definitions
block: Use the queue_flag_*() functions instead of open-coding these
block: Introduce blk_queue_flag_{set,clear,test_and_{set,clear}}()
block: Protect queue flag changes with the queue lock
mtip32xx: Use the blk_queue_flag_*() functions
bcache: Use the blk_queue_flag_{set,clear}() functions
iscsi: Use blk_queue_flag_set()
target/tcm_loop: Use blk_queue_flag_set()
block: Use blk_queue_flag_*() in drivers instead of queue_flag_*()
block: Complain if queue_flag_(set|clear)_unlocked() is abused
block: Move the queue_flag_*() functions from a public into a private
header file

 block/blk-core.c                            | 93 +++++++++++++++++++++++------
 block/blk-mq.c                              | 16 ++---
 block/blk-settings.c                        |  6 +-
 block/blk-stat.c                            |  6 +-
 block/blk-sysfs.c                           | 22 +++----
 block/blk-timeout.c                         |  6 +-
 block/blk.h                                 | 69 +++++++++++++++++++++
 block/bsg-lib.c                             |  4 +-
 drivers/block/drbd/drbd_nl.c                |  4 +-
 drivers/block/loop.c                        | 10 ++--
 drivers/block/mtip32xx/mtip32xx.c           |  8 +--
 drivers/block/nbd.c                         |  8 +--
 drivers/block/null_blk.c                    |  6 +-
 drivers/block/rbd.c                         |  4 +-
 drivers/block/rsxx/dev.c                    |  6 +-
 drivers/block/skd_main.c                    |  4 +-
 drivers/block/xen-blkfront.c                | 10 ++--
 drivers/block/zram/zram_drv.c               |  6 +-
 drivers/ide/ide-disk.c                      |  4 +-
 drivers/ide/ide-probe.c                     |  2 +-
 drivers/lightnvm/pblk-init.c                |  2 +-
 drivers/md/bcache/super.c                   |  6 +-
 drivers/md/dm-table.c                       | 16 ++---
 drivers/md/md-linear.c                      |  4 +-
 drivers/md/md.c                             |  4 +-
 drivers/md/raid0.c                          |  4 +-
 drivers/md/raid1.c                          |  6 +-
 drivers/md/raid10.c                         |  6 +-
 drivers/md/raid5.c                          |  4 +-
 drivers/mmc/core/queue.c                    |  8 +--
 drivers/mtd/mtd_blkdevs.c                   |  6 +-
 drivers/nvdimm/blk.c                        |  2 +-
 drivers/nvdimm/btt.c                        |  2 +-
 drivers/nvdimm/pmem.c                       |  4 +-
 drivers/nvme/host/core.c                    |  4 +-
 drivers/nvme/host/multipath.c               |  2 +-
 drivers/s390/block/dasd.c                   |  4 +-
 drivers/s390/block/dcssblk.c                |  2 +-
 drivers/s390/block/scm_blk.c                |  4 +-
 drivers/s390/block/xpram.c                  |  4 +-
 drivers/scsi/iscsi_tcp.c                    |  2 +-
 drivers/scsi/megaraid/megaraid_sas_base.c   |  2 +-
 drivers/scsi/megaraid/megaraid_sas_fusion.c |  2 +-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c        |  2 +-
 drivers/scsi/scsi_debug.c                   |  2 +-
 drivers/scsi/scsi_lib.c                     |  2 +-
 drivers/scsi/scsi_transport_sas.c           |  4 +-
 drivers/scsi/sd.c                           |  8 +--
 drivers/target/loopback/tcm_loop.c          |  2 +-
 include/linux/blkdev.h                      | 76 +++--------------------
 50 files changed, 270 insertions(+), 220 deletions(-)
Signature · 1 line
2.16.2