grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2 v2] LVM Cachevol and Integrity volumes break entire LVM V


From: Daniel Kiper
Subject: Re: [PATCH 2/2 v2] LVM Cachevol and Integrity volumes break entire LVM VG
Date: Wed, 22 May 2024 15:38:16 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Fri, Apr 26, 2024 at 09:00:08PM -0400, Patrick Plenefisch 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

May I ask you to use git "send-email" to send patches?

> lv matching must be done after processing, as integrity

After processing of what? Could you expand this commit message?

> 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;

I am OK with this change but it does not seem to belong to this patch.

>        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 */

Please fix this comment [1].

>    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;

I think this would be more clear:
  *p2 = '\0';

Daniel

[1] https://www.gnu.org/software/grub/manual/grub-dev/grub-dev.html#Comments



reply via email to

[Prev in Thread] Current Thread [Next in Thread]