mbox series

[v2,0/2] block: Fix __blkdev_issue_write_zeroes() limit handling

Message ID 20240815163228.216051-1-john.g.garry@oracle.com (mailing list archive)
Headers show
Series block: Fix __blkdev_issue_write_zeroes() limit handling | expand

Message

John Garry Aug. 15, 2024, 4:32 p.m. UTC
As reported in [0], we may get an infinite loop in
__blkdev_issue_write_zeroes() for making an XFS FS on a raid0 config.

Fix __blkdev_issue_write_zeroes() limit handling by reading the write
zeroes limit outside the loop.

Also include a change to drop the unnecessary NULL queue check in
bdev_write_zeroes_sectors().

[0] https://lore.kernel.org/linux-block/20240815062112.GA14067@lst.de/T/#m14ed5d882f9390a46cfe2fcfa2b51218aafbd32e

Differences to v1:
- Add RB tags from Christoph (thanks!)
- Update comment on __blkdev_issue_write_zeroes (Martin, Christoph)

John Garry (2):
  block: Read max write zeroes once for __blkdev_issue_write_zeroes()
  block: Drop NULL check in bdev_write_zeroes_sectors()

 block/blk-lib.c        | 25 ++++++++++++++++++-------
 include/linux/blkdev.h |  7 +------
 2 files changed, 19 insertions(+), 13 deletions(-)

Comments

Jens Axboe Aug. 19, 2024, 3:49 p.m. UTC | #1
On Thu, 15 Aug 2024 16:32:26 +0000, John Garry wrote:
> As reported in [0], we may get an infinite loop in
> __blkdev_issue_write_zeroes() for making an XFS FS on a raid0 config.
> 
> Fix __blkdev_issue_write_zeroes() limit handling by reading the write
> zeroes limit outside the loop.
> 
> Also include a change to drop the unnecessary NULL queue check in
> bdev_write_zeroes_sectors().
> 
> [...]

Applied, thanks!

[1/2] block: Read max write zeroes once for __blkdev_issue_write_zeroes()
      commit: 64b582ca88ca11400467b282d5fa3b870ded1c11
[2/2] block: Drop NULL check in bdev_write_zeroes_sectors()
      commit: 81475beb1b5996505a39cd1d9316ce1e668932a2

Best regards,