[PATCH v2 0/4] Diskseq support in device-mapper

From: Demi Marie Obenour
Date: Sat Jun 24 2023 - 19:10:13 EST


This work aims to allow userspace to create and destroy device-mapper
devices in a race-free way.

Changes since v1:

- Potentially backwards-incompatible changes to device-mapper now
require userspace opt-in.
- The code has been tested: I have a block script written in C that uses
these changes to successfully boot a Xen VM.
- The core block layer is completely untouched. Instead of exposing a
block device inode directly to userspace, device-mapper ioctls that
create a block device now return that device's diskseq. Userspace can
then use that diskseq to safely open the device. Furthermore, ioctls
that operate on an existing device-mapper device now accept a diskseq
parameter, which can be used to prevent races.

Demi Marie Obenour (4):
dm ioctl: Allow userspace to opt-in to strict parameter checks
dm ioctl: Allow userspace to provide expected diskseq
dm ioctl: Allow userspace to suppress uevent generation
dm ioctl: inform caller about already-existing device

drivers/md/dm-core.h | 2 +
drivers/md/dm-ioctl.c | 351 ++++++++++++++++++++++++++++------
drivers/md/dm.c | 5 +-
include/linux/device-mapper.h | 2 +-
include/uapi/linux/dm-ioctl.h | 90 ++++++++-
5 files changed, 382 insertions(+), 68 deletions(-)

--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab