← Back to team overview

curtin-dev team mailing list archive

Re: [Merge] ~dbungert/curtin:lp-2057661-flock-zfs-ctd into curtin:master

 


Diff comments:

> diff --git a/curtin/block/zfs.py b/curtin/block/zfs.py
> index ccdddbb..81ba1e1 100644
> --- a/curtin/block/zfs.py
> +++ b/curtin/block/zfs.py
> @@ -89,6 +90,7 @@ class ZPoolEncryption:
>          zfs_create(
>              self.poolname, "keystore", {"encryption": "off"}, keystore_size,
>          )
> +        udevadm_settle()

> I suspect this might actually be the real fix 

Agree

> Would it be cleaner if zfs_create called udevadm_settle(exists=$path) before returning? (It might also be nice if it returned the path too?)

I looked at that and decided against it, as these are interesting primarily in the special case where we're allocating a device in the pool instead of using zfs in the intended manner, and this function is the only one today doing that sort of device-in-the-pool thing.

>  
>          with ExitStack() as es:
>              for vdev in self.vdevs:
> @@ -97,13 +99,19 @@ class ZPoolEncryption:
>              # cryptsetup format and open this keystore
>              keystore_volume = f"/dev/zvol/{self.poolname}/keystore"
>              cmd = ["cryptsetup", "luksFormat", keystore_volume, self.keyfile]
> -            util.subp(cmd)
> +
> +            # strace has shown that udevd does indeed probe these keystores

Let's give it some thought, but I'm inclined to strace udevd in a variety of scenarios and ensuring there is a matching flock() or `udevadm settle` or both.

> +            with util.FlockEx(keystore_volume):
> +                util.subp(cmd, capture=True)
> +
> +            udevadm_settle()
> +
>              dm_name = f"keystore-{self.poolname}"
>              cmd = [
>                  "cryptsetup", "open", "--type", "luks", keystore_volume,
>                  dm_name, "--key-file", self.keyfile,
>              ]
> -            util.subp(cmd)
> +            util.subp(cmd, capture=True)

Done

>  
>          with ExitStack() as es:
>              # format as ext4, mount it, move the previously-generated systemkey


-- 
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/464246
Your team curtin developers is subscribed to branch curtin:master.



References