From: Yixuan Guo <g...@google.com> This applies to lvm2 LVs with redundancy, which use internal LVs, so it's necessary to go into seg->nodes[j].lv to find the underlying PV.
Example of a raid1 LV and its internal LVs, created with lvm2. ├─vdb3 254:19 0 9.3G 0 part │ └─vdb3_crypt 253:3 0 9.3G 0 crypt │ ├─crypt--vg-root_rmeta_0 253:11 0 4M 0 lvm │ │ └─crypt--vg-root 253:15 0 1G 0 lvm │ └─crypt--vg-root_rimage_0 253:12 0 1G 0 lvm │ └─crypt--vg-root 253:15 0 1G 0 lvm ├─vdb4 254:20 0 9.3G 0 part │ └─vdb4_crypt 253:4 0 9.3G 0 crypt │ ├─crypt--vg-root_rmeta_1 253:13 0 4M 0 lvm │ │ └─crypt--vg-root 253:15 0 1G 0 lvm │ └─crypt--vg-root_rimage_1 253:14 0 1G 0 lvm │ └─crypt--vg-root 253:15 0 1G 0 lvm Currently, grub-probe returns incomplete results for these LVs if their PVs are encrypted: $ grub-probe -t abstraction -d /dev/crypt-vg/root lvm This patch allows grub-probe to detect the underlying cryptodisk correctly: $ ./grub-probe -t abstraction -d /dev/crypt-vg/root cryptodisk luks2 gcry_rijndael gcry_rijndael gcry_sha256 cryptodisk luks2 gcry_rijndael gcry_rijndael gcry_sha256 lvm Signed-off-by: Yixuan Guo <g...@google.com> --- grub-core/disk/diskfilter.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c index 21e239511..6c24cabce 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -291,9 +291,8 @@ grub_diskfilter_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data, #ifdef GRUB_UTIL static grub_disk_memberlist_t -grub_diskfilter_memberlist (grub_disk_t disk) +grub_diskfilter_memberlist_lv (struct grub_diskfilter_lv *lv) { - struct grub_diskfilter_lv *lv = disk->data; grub_disk_memberlist_t list = NULL, tmp; struct grub_diskfilter_pv *pv; grub_disk_pull_t pull; @@ -367,6 +366,20 @@ grub_diskfilter_memberlist (grub_disk_t disk) tmp->next = list; list = tmp; } + else if (seg->nodes[j].lv != NULL) + { + tmp = grub_diskfilter_memberlist_lv(seg->nodes[j].lv); + if (tmp == NULL) + goto fail; + if (list != NULL) + { + grub_disk_memberlist_t tail = tmp; + while (tail->next != NULL) + tail = tail->next; + tail->next = list; + } + list = tmp; + } return list; @@ -381,6 +394,13 @@ grub_diskfilter_memberlist (grub_disk_t disk) return NULL; } +static grub_disk_memberlist_t +grub_diskfilter_memberlist (grub_disk_t disk) +{ + struct grub_diskfilter_lv *lv = disk->data; + return grub_diskfilter_memberlist_lv(lv); +} + void grub_diskfilter_get_partmap (grub_disk_t disk, void (*cb) (const char *pm, void *data), -- 2.43.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel