Skip to content

block: don't drain file system I/O on del_gendisk

Ming Lei linux-block linux-nvme linux-scsi 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest13 patches 35 repliesIn review
  2. v13 patches 8 repliesSuperseded

Changes in v2 from the cover letter

- take new approach to make current referring to q->disk reliable

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13block: declare blkcg_[init|exit]_queue in private headerblock/blk.h include/linux/blk-cgroup.h+8 -41 reply
2/13block: move initialization of q->blkg_list into blkcg_init_queueblock/blk-cgroup.c block/blk-core.c+2 -32 replies
3/13block: move blkcg initialization/destroy into disk allocation/release handlerblock/blk-core.c block/blk-sysfs.c block/genhd.c+14 -121 reply
4/13block/wbt: fix negative inflight counter when remove scsi deviceblock/bfq-iosched.c block/elevator.c+2 -22 replies
5/13block: only account passthrough IO from userspaceblock/blk-mq.c drivers/nvme/host/ioctl.c drivers/scsi/scsi_ioctl.c +1 more+17 -313 replies
6/13block: don't remove hctx debugfs dir from blk_mq_exit_queueblock/blk-mq.c+0 -11 reply
7/13block: move q_usage_counter release into blk_queue_releaseblock/blk-core.c block/blk-sysfs.c+2 -22 replies
8/13block: export __blk_mq_unfreeze_queueblock/blk-mq.c block/blk.h block/genhd.c +1 more+10 -31 reply
9/13scsi: force unfreezing queue into atomic modedrivers/scsi/sd.c+1 -15 replies
10/13block: add helper of disk_release_queue for release queue data for diskblock/genhd.c+15 -83 replies
11/13block: move blk_exit_queue into disk_releaseblock/blk-mq.c block/blk-sysfs.c block/genhd.c+41 -172 replies
12/13block: move rq_qos_exit() into disk_release()block/genhd.c+1 -11 reply
13/13block: don't drain file system I/O on del_gendiskblock/blk-core.c block/blk.h block/genhd.c +1 more+9 -351 reply

Reviews trailers per patch

6 of 13 patches have a Reviewed-by or Acked-by.

PatchChristoph HellwigBart Van Assche
1/13
2/13R-b R-b
3/13R-b
4/13R-b
5/13
6/13R-b
7/13R-b R-b
8/13
9/13
10/13
11/13
12/13R-b
13/13

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

Read the v2 thread

Cover letter [PATCH V2 00/13] block: don't drain file system I/O on del_gendisk

Hello,

Draining FS I/O on del_gendisk() is added for just avoiding to refer to recently added q->disk in IO path, and it isn't actually reliable:

1) queue freezing can't drain FS I/O for bio based driver, so blk-cgroup shutdown can't be moved into del_gendisk()

2) freezing queue can't drain in-progress IO issue/dispatch activities, so elevator shutdown can't be moved into del_gendisk()

3) the added flag of GD_DEAD may not be observed reliably in __bio_queue_enter() because queue freezing might not imply rcu grace period.

4) passthrough IO accounting code can refer to q->disk after disk is released

When releasing disk, all FS IOs are guaranteed to be done, so this patchset tries to shutdown elevator/blk-cgroup/rq qos there, then referring to q->disk can be avoided after disk is released.

Also add flag of BLK_MQ_REQ_USER_IO for accounting passthrough IO only if the IO is from userspace, since disk is live for user passthrough IO.

V2:
- take new approach to make current referring to q->disk reliable

Laibin Qiu (1):
block/wbt: fix negative inflight counter when remove scsi device

Ming Lei (12):
block: declare blkcg_[init|exit]_queue in private header
block: move initialization of q->blkg_list into blkcg_init_queue
block: move blkcg initialization/destroy into disk allocation/release
handler
block: only account passthrough IO from userspace
block: don't remove hctx debugfs dir from blk_mq_exit_queue
block: move q_usage_counter release into blk_queue_release
block: export __blk_mq_unfreeze_queue
scsi: force unfreezing queue into atomic mode
block: add helper of disk_release_queue for release queue data for
disk
block: move blk_exit_queue into disk_release
block: move rq_qos_exit() into disk_release()
block: don't drain file system I/O on del_gendisk

 block/bfq-iosched.c        |  2 +
 block/blk-cgroup.c         |  2 +
 block/blk-core.c           | 31 ++++----------
 block/blk-mq.c             | 27 ++++++++++--
 block/blk-sysfs.c          | 25 +-----------
 block/blk.h                | 10 ++++-
 block/elevator.c           |  2 -
 block/genhd.c              | 84 +++++++++++++++++++++++++++-----------
 drivers/nvme/host/ioctl.c  |  2 +-
 drivers/scsi/scsi_ioctl.c  |  3 +-
 drivers/scsi/sd.c          |  2 +-
 include/linux/blk-cgroup.h |  4 --
 include/linux/blk-mq.h     |  3 ++
 include/linux/genhd.h      |  1 -
 14 files changed, 114 insertions(+), 84 deletions(-)
Signature · 1 line
2.31.1