Skip to content

block: Fix block device shutdown related races

Jan Kara linux-block 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest10 patches 3 repliesIn review
  2. v411 patches 9 repliesSuperseded
  3. v311 patches 8 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v213 patches26 repliesSuperseded
v110 patches17 repliesSuperseded

Changes in v5 from the cover letter

* Dropped patch fixing possible gendisk shutdown vs blkdev_open race - needs more thinking
* Added Tejun's ack

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10block: Fix bdi assignment to bdev inode when racing with disk deletefs/block_dev.c+3 -40 replies
2/10bdi: Mark congested->bdi as internalinclude/linux/backing-dev-defs.h mm/backing-dev.c+8 -60 replies
3/10bdi: Make wb->bdi a proper referencemm/backing-dev.c+11 -20 replies
4/10bdi: Unify bdi->wb_list handling for root wb_writebackmm/backing-dev.c+28 -60 replies
5/10bdi: Shutdown writeback on all cgwbs in cgwb_bdi_destroy()include/linux/backing-dev-defs.h mm/backing-dev.c+23 -00 replies
6/10bdi: Do not wait for cgwbs release in bdi_unregister()include/linux/backing-dev-defs.h mm/backing-dev.c+1 -220 replies
7/10bdi: Rename cgwb_bdi_destroy() to cgwb_bdi_unregister()mm/backing-dev.c+3 -30 replies
8/10block: Fix oops in locked_inode_to_wb_and_lock_list()fs/block_dev.c include/linux/writeback.h+3 -60 replies
9/10kobject: Export kobject_get_unless_zero()include/linux/kobject.h lib/kobject.c+6 -10 replies
10/10block: Fix oops scsi_disk_get()block/genhd.c+1 -10 replies

Reviews trailers per patch

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

PatchTejun HeoHannes ReineckeBart Van AsscheLekshmi Pillai
1/10A-b R-b
2/10A-b
3/10A-b
4/10A-b
5/10A-b
6/10A-b
7/10A-b
8/10A-b
9/10A-b R-b
10/10A-b R-b T-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 4 reviewers.

Read the v5 thread

Cover letter [PATCH 0/10 v5] block: Fix block device shutdown related races

Hello,

this is a series with the remaining patches (on top of 4.11-rc2) to fix several different races and issues I've found when testing device shutdown and reuse. The first patch fixes possible (theoretical) problems when opening of a block device races with shutdown of a gendisk structure. Patches 2-8 fix oops that is triggered by __blkdev_put() calling inode_detach_wb() too early (the problem reported by Thiago). Patches 9 and 10 fix oops due to a bug in gendisk code where get_gendisk() can return already freed gendisk structure (again triggered by Omar's stress test).

All patches got reviewed by Tejun and also tested by Thiago (thanks!). Jens, can you please queue these fixes for the next merge window? Thanks!

Changes since v4:
* Dropped patch fixing possible gendisk shutdown vs blkdev_open race - needs more thinking
* Added Tejun's ack

Changes since v3:
* Rebased on top of 4.11-rc2
* Reworked patch 2 (block: Fix race of bdev open with gendisk shutdown) based on Tejun's feedback
* Significantly updated patch 5 (and dropped previous Tejun's ack) to accommodate for fixes to SCSI re-registration of BDI that went to 4.11-rc2

Changes since v2:
* Added Tejun's acks
* Rebased on top of 4.11-rc1
* Fixed two possible races between blkdev_open() and del_gendisk()
* Fixed possible race between concurrent shutdown of cgwb spotted by Tejun

Changes since v1:
* Added Acks and Tested-by tags for patches in areas that did not change
* Reworked inode_detach_wb() related fixes based on Tejun's feedback

Honza