Re: [PATCH v2 16/16] xen-blkback: Inform userspace that device has been opened

From: Demi Marie Obenour
Date: Thu Jun 08 2023 - 11:24:37 EST


On Thu, Jun 08, 2023 at 12:08:55PM +0200, Roger Pau Monné wrote:
> On Tue, May 30, 2023 at 04:31:16PM -0400, Demi Marie Obenour wrote:
> > Set "opened" to "0" before the hotplug script is called. Once the
> > device node has been opened, set "opened" to "1".
> >
> > "opened" is used exclusively by userspace. It serves two purposes:
> >
> > 1. It tells userspace that the diskseq Xenstore entry is supported.
> >
> > 2. It tells userspace that it can wait for "opened" to be set to 1.
> > Once "opened" is 1, blkback has a reference to the device, so
> > userspace doesn't need to keep one.
> >
> > Together, these changes allow userspace to use block devices with
> > delete-on-close behavior, such as loop devices with the autoclear flag
> > set or device-mapper devices with the deferred-remove flag set.
>
> Now that I think a bit more about this, how are you planning to handle
> reboot with such devices? It's fine for loop (because those get
> instantiated by the block script), but likely not with other block
> devices, as on reboot the toolstack will find the block device is
> gone.
>
> I guess the delete-on-close is only intended to be used for loop
> devices? (or in general block devices that are instantiated by the
> block script itself)

You understand correctly.
--
Sincerely,
Demi Marie Obenour (she/her/hers)
Invisible Things Lab

Attachment: signature.asc
Description: PGP signature