From: Luca Boccassi Date: Thu, 9 Feb 2023 01:21:07 +0000 (+0000) Subject: libblkid: try LUKS2 first when probing X-Git-Tag: v2.39-rc1~65^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8889c0a214aeb3dd47bf1ab280fe5534b64d2aa;p=thirdparty%2Futil-linux.git libblkid: try LUKS2 first when probing 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 --- diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c index c7789a15be..fb03927078 100644 --- a/libblkid/src/superblocks/superblocks.c +++ b/libblkid/src/superblocks/superblocks.c @@ -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,