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

Demi Marie Obenour
2023-06-08T15:24:35Z

[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]