Skip to content

Validate logical block size in blk_validate_limits()

John Garry linux-block lkml virtualization 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 6 repliesApplied
  2. v15 patches 11 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5virtio_blk: Fix default logical block size fallbackdrivers/block/virtio_blk.c+13 -130 replies
2/5block: Validate logical block size in blk_validate_limits()block/blk-settings.c include/linux/blkdev.h+5 -01 reply
3/5null_blk: Don't bother validating blocksizedrivers/block/null_blk/main.c+0 -32 replies
4/5virtio_blk: Don't bother validating blocksizedrivers/block/virtio_blk.c+1 -101 reply
5/5loop: Don't bother validating blocksizedrivers/block/loop.c+1 -111 reply

Reviews trailers per patch

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

PatchChristoph HellwigMichael S. TsirkinStefan HajnocziZhu YanjunDamien Le Moal
1/5R-b A-b R-b
2/5R-b
3/5R-b R-b R-b
4/5R-b A-b R-b R-b
5/5R-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 5 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/5] Validate logical block size in blk_validate_limits()

This series adds validation of the logical block size in blk_validate_limits().

Some drivers had already been validating this themselves. As such, we can mostly drop that driver validation.

nbd is problematic, as we cannot only change to just stop calling blk_validate_limits(). This is because the LBS is updated in a 2-stage process:
a. update block size in the driver and validate
b. update queue limits

So if we stop validating the limits in a., there is a user-visible change in behaviour (as we stop rejecting invalid limits from the NBD_SET_BLKSIZE ioctl). So I left that untouched.

This topic was originally mentioned in [0] and then again in [1] by Keith.

I have also included a related virtio_blk change to deal with blk_size config fallback.

[0] https://lore.kernel.org/linux-block/[email protected]/
[1] https://lore.kernel.org/linux-block/[email protected]/

Differences to v1:
- Add RB tags (thanks!)
- Update comment on blk_validate_block_size() and add print in blk_validate_limits()

John Garry (5):
virtio_blk: Fix default logical block size fallback
block: Validate logical block size in blk_validate_limits()
null_blk: Don't bother validating blocksize
virtio_blk: Don't bother validating blocksize
loop: Don't bother validating blocksize

 block/blk-settings.c          |  4 ++++
 drivers/block/loop.c          | 12 +-----------
 drivers/block/null_blk/main.c |  3 ---
 drivers/block/virtio_blk.c    | 31 +++++++++++--------------------
 include/linux/blkdev.h        |  1 +
 5 files changed, 17 insertions(+), 34 deletions(-)
Signature · 1 line
2.31.1