All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Daniel Kiper <dkiper@net-space.pl>, kees@ubuntu.com
Cc: grub-devel@gnu.org
Subject: Re: [PATCH] osdep/linux: Fix md array device enumeration
Date: Wed, 6 Oct 2021 09:28:32 +0200	[thread overview]
Message-ID: <YV1QIDck60WTLwV3@pevik> (raw)
In-Reply-To: <20211005163813.3osmfiey5icpltrf@tomti.i.net-space.pl>

Hi Kees, Daniel,

> On Sat, Sep 25, 2021 at 07:03:35PM -0700, kees@ubuntu.com wrote:
> > From: Kees Cook <kees@ubuntu.com>

> > GET_ARRAY_INFO's info.nr_disks does not map to GET_DISK_INFO's
> > disk.number, which is an internal kernel index. If an array has had drives
> > added, removed, etc, there may be gaps in GET_DISK_INFO's results. But
> > since the consumer of devicelist cannot tolerate gaps (it expects to walk
> > a NULL-terminated list of device name strings), the devicelist index (j)
> > must be tracked separately from the disk.number index (i). But grub
> > wants to only examine active (i.e. present and non-failed) disks, so how
> > many disks are left to be queried must be also separately tracked
> > (remaining).

Kees, thanks a lot for taking care for this.

<snip>
> > +      /* Skip empty slot: MD_DISK_REMOVED slots don't count toward nr_disks. */
> >        if (disk.state & (1 << MD_DISK_REMOVED))
> >  	continue;
> > +      remaining--;

> > -      if (disk.state & (1 << MD_DISK_ACTIVE))
> > -	devicelist[j] = grub_find_device (NULL,
> > -					  makedev (disk.major, disk.minor));
> > -      else
> > -	devicelist[j] = NULL;
> > -      j++;
> > +      /* Only examine disks that are actively participating in the array. */
> > +      if (!(disk.state & (1 << MD_DISK_ACTIVE)))
> > +	continue;
> > +
> > +      devicelist[j++] = grub_find_device (NULL, makedev (disk.major,
> > +							 disk.minor));

> I would prefer if you leave original if statement as is and update
> grub_find_device() call accordingly... And of course drop else as
> needed... :-)
I suppose you'll need to send v2 due this, but for now:

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


  reply	other threads:[~2021-10-06  7:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26  2:03 [PATCH] osdep/linux: Fix md array device enumeration kees
2021-10-05 16:38 ` Daniel Kiper
2021-10-06  7:28   ` Petr Vorel [this message]
2021-10-07 23:36     ` Kees Cook
2021-10-08  8:25       ` Petr Vorel
2021-10-07 23:34   ` Kees Cook
  -- strict thread matches above, loose matches on Subject: below --
2023-06-06 16:10 Julian Andres Klode
2023-06-06 16:15 ` Julian Andres Klode
2023-06-06 17:09   ` Daniel Kiper
2023-06-06 17:26     ` Julian Andres Klode
2023-06-06 18:02       ` Kees Cook
2023-06-07 13:39         ` Daniel Kiper
2023-06-07 21:33           ` Kees Cook
2023-06-12 14:24             ` Daniel Kiper
2021-01-16 17:27 [PATCH] Fix md RAID enumeration Kees Cook
2021-01-17 21:38 ` [PATCH] osdep/linux: Fix md array device enumeration Kees Cook

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=YV1QIDck60WTLwV3@pevik \
    --to=pvorel@suse.cz \
    --cc=dkiper@net-space.pl \
    --cc=grub-devel@gnu.org \
    --cc=kees@ubuntu.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.