grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Plenefisch <simonpatp@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>,
	Daniel Kiper <dkiper@net-space.pl>
Subject: Re: [PATCH 2/2 v2] LVM Cachevol and Integrity volumes break entire LVM VG
Date: Thu, 16 May 2024 15:38:17 -0400	[thread overview]
Message-ID: <CAOCpoWe0OzaoUp2wAfKSsttxi4xo9YnXWg8RUc4bACUHF-Bwqw@mail.gmail.com> (raw)
In-Reply-To: <CAOCpoWcobwPuYQJyRAAunncTOXb0b-VW2zaxtBnCn4aWKXLSRg@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 5480 bytes --]

Daniel,

I haven't heard any update about my patch from you since early February. Is
there anything I need to do or is this good to go? I'm not too familiar
with actually submitting patches to mailing-list based development, so let
me know if everything is all set or I need to do something else.

Thanks,
Patrick


On Fri, Apr 26, 2024 at 9:00 PM Patrick Plenefisch <simonpatp@gmail.com>
wrote:

> From 8cfb6dbb011d3773b90a3cbb8561616a2fb5955f Mon Sep 17 00:00:00 2001
> From: Patrick Plenefisch <simonpatp@gmail.com>
> Date: Sun, 18 Feb 2024 18:36:05 -0500
> Subject: [PATCH 2/2] lvm: Add support for cachevol and integrity lv
>
> lv matching must be done after processing, as integrity
> volumes may have several levels that the segments must be
> shifted through
>
> pv matching must be completely finished before validating a
> volume, otherwise referenced raid stripes may not have pv
> data applied yet
>
> Signed-off-by: Patrick Plenefisch <simonpatp@gmail.com>
> ---
>  grub-core/disk/diskfilter.c |  6 ++-
>  grub-core/disk/lvm.c        | 83 +++++++++++++++++++++++--------------
>  2 files changed, 56 insertions(+), 33 deletions(-)
>
> diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c
> index 21e239511..dc3bd943b 100644
> --- a/grub-core/disk/diskfilter.c
> +++ b/grub-core/disk/diskfilter.c
> @@ -966,8 +966,6 @@ grub_diskfilter_vg_register (struct grub_diskfilter_vg
> *vg)
>
>    for (lv = vg->lvs; lv; lv = lv->next)
>      {
> -      grub_err_t err;
> -
>        /* RAID 1 and single-disk RAID 0 don't use a chunksize but code
>           assumes one so set one. */
>        for (i = 0; i < lv->segment_count; i++)
> @@ -979,6 +977,10 @@ grub_diskfilter_vg_register (struct
> grub_diskfilter_vg *vg)
>        && lv->segments[i].stripe_size == 0)
>      lv->segments[i].stripe_size = 64;
>   }
> +    }
> +  for (lv = vg->lvs; lv; lv = lv->next)
> +    {
> +      grub_err_t err;
>
>        err = validate_lv(lv);
>        if (err)
> diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
> index 10bc965a4..7615a507a 100644
> --- a/grub-core/disk/lvm.c
> +++ b/grub-core/disk/lvm.c
> @@ -805,13 +805,27 @@ grub_lvm_detect (grub_disk_t disk,
>    seg->nodes[seg->node_count - 1].name = tmp;
>   }
>      }
> +  /* Cache and integrity LVs have extra parts that
> +     we can ignore for our read-only access */
>    else if (grub_memcmp (p, "cache\"",
> -   sizeof ("cache\"") - 1) == 0)
> +   sizeof ("cache\"") - 1) == 0
> +   || grub_memcmp (p, "cache+CACHE_USES_CACHEVOL\"",
> +   sizeof ("cache+CACHE_USES_CACHEVOL\"") - 1) == 0
> +   || grub_memcmp (p, "integrity\"",
> +   sizeof ("integrity\"") - 1) == 0)
>      {
>        struct ignored_feature_lv *ignored_feature = NULL;
>
>        char *p2, *p3;
>        grub_size_t sz;
> +#ifdef GRUB_UTIL
> +      p2 = grub_strchr (p, '"');
> +      if (p2)
> + *p2 = 0;
> +      grub_util_info ("Ignoring extra metadata type '%s' for %s", p,
> lv->name);
> +      if (p2)
> + *p2 ='"';
> +#endif
>
>        ignored_feature = grub_zalloc (sizeof (*ignored_feature));
>        if (!ignored_feature)
> @@ -936,36 +950,6 @@ grub_lvm_detect (grub_disk_t disk,
>      }
>   }
>
> -      /* Match lvs.  */
> -      {
> - struct grub_diskfilter_lv *lv1;
> - struct grub_diskfilter_lv *lv2;
> - for (lv1 = vg->lvs; lv1; lv1 = lv1->next)
> -  for (i = 0; i < lv1->segment_count; i++)
> -    for (j = 0; j < lv1->segments[i].node_count; j++)
> -      {
> - if (vg->pvs)
> -  for (pv = vg->pvs; pv; pv = pv->next)
> -    {
> -      if (! grub_strcmp (pv->name,
> - lv1->segments[i].nodes[j].name))
> - {
> -  lv1->segments[i].nodes[j].pv = pv;
> -  break;
> - }
> -    }
> - if (lv1->segments[i].nodes[j].pv == NULL)
> -  for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
> -    {
> -      if (lv1 == lv2)
> -        continue;
> -      if (grub_strcmp (lv2->name,
> -       lv1->segments[i].nodes[j].name) == 0)
> - lv1->segments[i].nodes[j].lv = lv2;
> -    }
> -      }
> -
> -      }
>
>        {
>   struct ignored_feature_lv *ignored_feature;
> @@ -1014,9 +998,46 @@ grub_lvm_detect (grub_disk_t disk,
>      ignored_feature->lv = NULL;
>    }
>        }
> +  else
> +  {
> +
> +#ifdef GRUB_UTIL
> +      grub_util_info ("Couldn't find LVM part of ignored feature on
> %s", ignored_feature->origin);
> +#endif
> +  }
>    }
>        }
>
> +      /* Match lvs. Must be done after cache and integrity are found  */
> +      {
> + struct grub_diskfilter_lv *lv1;
> + struct grub_diskfilter_lv *lv2;
> + for (lv1 = vg->lvs; lv1; lv1 = lv1->next)
> +  for (i = 0; i < lv1->segment_count; i++)
> +    for (j = 0; j < lv1->segments[i].node_count; j++)
> +      {
> + if (vg->pvs)
> +  for (pv = vg->pvs; pv; pv = pv->next)
> +    {
> +      if (! grub_strcmp (pv->name,
> + lv1->segments[i].nodes[j].name))
> + {
> +  lv1->segments[i].nodes[j].pv = pv;
> +  break;
> + }
> +    }
> + if (lv1->segments[i].nodes[j].pv == NULL)
> +  for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
> +    {
> +      if (lv1 == lv2)
> +        continue;
> +      if (grub_strcmp (lv2->name,
> +       lv1->segments[i].nodes[j].name) == 0)
> + lv1->segments[i].nodes[j].lv = lv2;
> +    }
> +      }
> +      }
> +
>    grub_lvm_free_ignored_feature_lvs (ignored_feature_lvs);
>        if (grub_diskfilter_vg_register (vg))
>   goto fail4;
> --
> 2.39.2
>

[-- Attachment #1.2: Type: text/html, Size: 6885 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  reply	other threads:[~2024-05-16 19:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-27  1:00 [PATCH 2/2 v2] LVM Cachevol and Integrity volumes break entire LVM VG Patrick Plenefisch
2024-05-16 19:38 ` Patrick Plenefisch [this message]
2024-05-16 21:39   ` Daniel Kiper
2024-05-22 13:38 ` Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOCpoWe0OzaoUp2wAfKSsttxi4xo9YnXWg8RUc4bACUHF-Bwqw@mail.gmail.com \
    --to=simonpatp@gmail.com \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).