]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: try LUKS2 first when probing
authorLuca Boccassi <bluca@debian.org>
Thu, 9 Feb 2023 01:21:07 +0000 (01:21 +0000)
committerLuca Boccassi <bluca@debian.org>
Wed, 22 Feb 2023 02:02:03 +0000 (02:02 +0000)
If a device is locked with OPAL we'll get an I/O error when probing
past the LUKS2 header. Try it first to avoid this issue. It is
useful regardless, as when we find a LUKS superblock we stop there
anyway, no need to check futher.

Signed-off-by: Luca Boccassi <bluca@debian.org>
libblkid/src/superblocks/superblocks.c

index c7789a15be29ae7ab20e2802a8b76d888a94cef2..fb0392707896bdcc48df33b8ac63b878812533bc 100644 (file)
@@ -94,6 +94,11 @@ static int blkid_probe_set_usage(blkid_probe pr, int usage);
  */
 static const struct blkid_idinfo *idinfos[] =
 {
+       /* In case the volume is locked with OPAL we are going to get
+        * an I/O error when reading past the LUKS header, so try it
+        * first. */
+       &luks_idinfo,
+
        /* RAIDs */
        &linuxraid_idinfo,
        &ddfraid_idinfo,
@@ -119,7 +124,6 @@ static const struct blkid_idinfo *idinfos[] =
        &snapcow_idinfo,
        &verity_hash_idinfo,
        &integrity_idinfo,
-       &luks_idinfo,
        &vmfs_volume_idinfo,
        &ubi_idinfo,
        &vdo_idinfo,