Skip to content

RFC Allow race-free block device handling

Demi Marie Obenour dm-devel linux-block lkml xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 of 7 patches 13 repliesIn review

6 of 7 patches are in this archive. The cover letter announces 7.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7block: Support creating a struct file from a block deviceblock/bdev.c include/linux/blkdev.h+70 -128 replies
2/7Allow userspace to get an FD to a newly-created DM devicedrivers/md/dm-ioctl.c include/uapi/linux/dm-ioctl.h+72 -110 replies
3/7Implement diskseq checks in blkbackdrivers/block/xen-blkback/xenbus.c+100 -370 replies
4/7Increment diskseq when releasing a loop deviceblock/genhd.c drivers/block/loop.c+7 -01 reply
6/7Minor blkback cleanupsdrivers/block/xen-blkback/blkback.c+5 -30 replies
7/7xen/blkback: Inform userspace that device has been openeddrivers/block/xen-blkback/xenbus.c+34 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/7] Allow race-free block device handling

This work aims to allow userspace to create and destroy block devices in a race-free and leak-free way, and to allow them to be exposed to other Xen VMs via blkback without leaks or races. It’s marked as RFC for a few reasons:

- The code has been only lightly tested. It might be unstable or insecure.

- The DM_DEV_CREATE ioctl gains a new flag. Unknown flags were previously ignored, so this could theoretically break buggy userspace tools.

- I have no idea if I got the block device reference counting and locking correct.

Demi Marie Obenour (7):
block: Support creating a struct file from a block device Allow userspace to get an FD to a newly-created DM device Implement diskseq checks in blkback
Increment diskseq when releasing a loop device If autoclear is set, delete a no-longer-used loop device Minor blkback cleanups
xen/blkback: Inform userspace that device has been opened

 block/bdev.c                        |  77 +++++++++++--
 block/genhd.c                       |   1 +
 drivers/block/loop.c                |  17 ++-
 drivers/block/xen-blkback/blkback.c |   8 +-
 drivers/block/xen-blkback/xenbus.c  | 171 ++++++++++++++++++++++------
 drivers/md/dm-ioctl.c               |  67 +++++++++--
 include/linux/blkdev.h              |   5 +
 include/uapi/linux/dm-ioctl.h       |  16 ++-
 8 files changed, 298 insertions(+), 64 deletions(-)
Signature · 3 lines
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab