From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: grub-probe seems to be having problems
Date: Sat, 03 Mar 2012 23:00:28 +0100 [thread overview]
Message-ID: <4F52947C.3010500@gmail.com> (raw)
In-Reply-To: <20120301194758.GE22241@caffeine.csclub.uwaterloo.ca>
[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]
On 01.03.2012 20:47, Lennart Sorensen wrote:
> root@rceng03new:~# /usr/sbin/grub-probe --device /dev/md1 --target=partmap
> /usr/sbin/grub-probe: error: disk `mduuid/dc00bd3a0e9491bb0b66fa8b9246c2e8' not found.
Attached patch eliminates some idiosyncracies problems with mdraid 1.x.
Also fixes partial import problem and raid5 partial array problem.
> That seems wrong.
>
> So does:
>
> root@rceng03new:~# /usr/sbin/grub-probe --device /dev/md0 --target=partmap
> /usr/sbin/grub-probe: error: Couldn't find physical volume `(null)'. Check your device.map.
>
> root@rceng03new:~# cat /proc/mdstat
> Personalities : [raid1] [raid6] [raid5] [raid4]
> md1 : active raid5 sdd3[4] sdc3[3](F) sda3[0] sdb3[1]
> 284773376 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3] [UUU]
>
> md0 : active raid1 sdd2[2] sda2[0] sdb2[1]
> 976884 blocks super 1.2 [3/3] [UUU]
>
> unused devices:<none>
>
> grub-install never seems to generate a device.map file anymore either,
> although --recheck happily deletes it for me.
>
> What is supposed to generate the /boot/grub/device.map these days?
>
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: raid.diff --]
[-- Type: text/x-diff, Size: 6107 bytes --]
=== modified file 'grub-core/disk/diskfilter.c'
--- grub-core/disk/diskfilter.c 2012-02-29 13:57:59 +0000
+++ grub-core/disk/diskfilter.c 2012-03-03 21:51:18 +0000
@@ -41,24 +41,24 @@
static struct grub_diskfilter_lv *
find_lv (const char *name);
-static int is_lv_readable (struct grub_diskfilter_lv *lv);
+static int is_lv_readable (struct grub_diskfilter_lv *lv, int easily);
\f
static grub_err_t
-is_node_readable (const struct grub_diskfilter_node *node)
+is_node_readable (const struct grub_diskfilter_node *node, int easily)
{
/* Check whether we actually know the physical volume we want to
read from. */
if (node->pv)
return !!(node->pv->disk);
if (node->lv)
- return is_lv_readable (node->lv);
+ return is_lv_readable (node->lv, easily);
return 0;
}
static int
-is_lv_readable (struct grub_diskfilter_lv *lv)
+is_lv_readable (struct grub_diskfilter_lv *lv, int easily)
{
unsigned i, j;
if (!lv)
@@ -69,10 +69,12 @@
switch (lv->segments[i].type)
{
case GRUB_DISKFILTER_RAID6:
- need--;
+ if (!easily)
+ need--;
case GRUB_DISKFILTER_RAID4:
case GRUB_DISKFILTER_RAID5:
- need--;
+ if (!easily)
+ need--;
case GRUB_DISKFILTER_STRIPED:
break;
@@ -92,7 +94,7 @@
}
for (j = 0; j < lv->segments[i].node_count; j++)
{
- if (is_node_readable (lv->segments[i].nodes + j))
+ if (is_node_readable (lv->segments[i].nodes + j, easily))
have++;
if (have >= need)
break;
@@ -192,6 +194,8 @@
{
grub_disk_dev_t p;
grub_disk_pull_t pull;
+ struct grub_diskfilter_vg *vg;
+ struct grub_diskfilter_lv *lv = NULL;
for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++)
for (p = grub_disk_dev_list; p; p = p->next)
@@ -200,9 +204,20 @@
{
if ((p->iterate) (scan_disk, pull))
return;
- if (arname && is_lv_readable (find_lv (arname)))
+ if (arname && is_lv_readable (find_lv (arname), 1))
return;
}
+
+ for (vg = array_list; vg; vg = vg->next)
+ {
+ if (vg->lvs)
+ for (lv = vg->lvs; lv; lv = lv->next)
+ if (!lv->scanned && lv->fullname && lv->became_readable_at)
+ {
+ scan_disk (lv->fullname);
+ lv->scanned = 1;
+ }
+ }
}
static int
@@ -243,18 +258,36 @@
struct grub_diskfilter_lv *lv = disk->data;
grub_disk_memberlist_t list = NULL, tmp;
struct grub_diskfilter_pv *pv;
-
- if (lv->vg->pvs)
- for (pv = lv->vg->pvs; pv; pv = pv->next)
- {
- if (!pv->disk)
- grub_util_error (_("Couldn't find physical volume `%s'."
- " Check your device.map"), pv->name);
- tmp = grub_malloc (sizeof (*tmp));
- tmp->disk = pv->disk;
- tmp->next = list;
- list = tmp;
- }
+ grub_disk_pull_t pull;
+ grub_disk_dev_t p;
+
+ if (!lv->vg->pvs)
+ return NULL;
+
+ pv = lv->vg->pvs;
+ while (pv && pv->disk)
+ pv = pv->next;
+
+ for (pull = 0; pv && pull < GRUB_DISK_PULL_MAX; pull++)
+ for (p = grub_disk_dev_list; pv && p; p = p->next)
+ if (p->id != GRUB_DISK_DEVICE_DISKFILTER_ID
+ && p->iterate)
+ {
+ (p->iterate) (scan_disk, pull);
+ while (pv && pv->disk)
+ pv = pv->next;
+ }
+
+ for (pv = lv->vg->pvs; pv; pv = pv->next)
+ {
+ if (!pv->disk)
+ grub_util_error (_("Couldn't find physical volume `%s'."
+ " Check your device.map"), pv->name);
+ tmp = grub_malloc (sizeof (*tmp));
+ tmp->disk = pv->disk;
+ tmp->next = list;
+ list = tmp;
+ }
return list;
}
@@ -318,7 +351,7 @@
{
if (uuid_len == vg->uuid_len
&& grub_memcmp (uuidbin, vg->uuid, uuid_len) == 0)
- if (is_lv_readable (vg->lvs))
+ if (is_lv_readable (vg->lvs, 0))
return vg->lvs;
}
}
@@ -328,7 +361,7 @@
if (vg->lvs)
for (lv = vg->lvs; lv; lv = lv->next)
if (lv->fullname && grub_strcmp (lv->fullname, name) == 0
- && is_lv_readable (lv))
+ && is_lv_readable (lv, 0))
return lv;
}
return NULL;
@@ -997,10 +1030,14 @@
pv->start_sector += pv->part_start;
/* Add the device to the array. */
for (lv = array->lvs; lv; lv = lv->next)
- if (!lv->became_readable_at && lv->fullname && is_lv_readable (lv))
+ if (!lv->became_readable_at && lv->fullname && is_lv_readable (lv, 0))
{
lv->became_readable_at = ++inscnt;
- scan_disk (lv->fullname);
+ if (is_lv_readable (lv, 1))
+ {
+ scan_disk (lv->fullname);
+ lv->scanned = 1;
+ }
}
break;
}
=== modified file 'grub-core/disk/mdraid1x_linux.c'
--- grub-core/disk/mdraid1x_linux.c 2012-02-26 22:36:12 +0000
+++ grub-core/disk/mdraid1x_linux.c 2012-03-03 21:55:31 +0000
@@ -177,11 +177,6 @@
/* Spares aren't implemented. */
return NULL;
- if (grub_le_to_cpu32 (sb.dev_number)
- >= grub_le_to_cpu32 (sb.raid_disks))
- /* Spares aren't implemented. */
- return NULL;
-
if (grub_disk_read (disk, sector,
(char *) &sb.dev_roles[sb.dev_number]
- (char *) &sb,
=== modified file 'include/grub/diskfilter.h'
--- include/grub/diskfilter.h 2012-02-11 10:57:47 +0000
+++ include/grub/diskfilter.h 2012-03-03 21:34:54 +0000
@@ -87,7 +87,7 @@
grub_size_t segment_alloc;
grub_uint64_t size;
int became_readable_at;
-
+ int scanned;
int visible;
/* Pointer to segment_count segments. */
=== modified file 'util/raid.c'
--- util/raid.c 2012-02-05 10:07:33 +0000
+++ util/raid.c 2012-03-03 21:27:26 +0000
@@ -70,19 +70,22 @@
devicelist = xmalloc ((info.nr_disks + 1) * sizeof (char *));
- for (i = 0, j = 0; i <info.nr_disks; i++)
+ for (i = 0, j = 0; j < info.nr_disks; i++)
{
disk.number = i;
ret = ioctl (fd, GET_DISK_INFO, &disk);
if (ret != 0)
grub_util_error (_("ioctl GET_DISK_INFO error: %s"), strerror (errno));
+
+ if (disk.state & (1 << MD_DISK_REMOVED))
+ continue;
if (disk.state & (1 << MD_DISK_ACTIVE))
- {
- devicelist[j] = grub_find_device (NULL,
- makedev (disk.major, disk.minor));
- j++;
- }
+ devicelist[j] = grub_find_device (NULL,
+ makedev (disk.major, disk.minor));
+ else
+ devicelist[j] = NULL;
+ j++;
}
devicelist[j] = NULL;
next prev parent reply other threads:[~2012-03-03 22:00 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-01 19:47 grub-probe seems to be having problems Lennart Sorensen
2012-03-01 20:04 ` Lennart Sorensen
2012-03-01 20:07 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-01 20:15 ` Lennart Sorensen
2012-03-01 20:19 ` Lennart Sorensen
2012-03-03 22:00 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2012-03-05 20:07 ` Lennart Sorensen
2012-03-05 23:10 ` Lennart Sorensen
2012-03-08 17:46 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-08 19:01 ` Lennart Sorensen
2012-03-08 19:14 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-08 20:15 ` Lennart Sorensen
2012-03-08 23:37 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-09 14:53 ` Lennart Sorensen
2012-03-09 0:11 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-09 15:39 ` Lennart Sorensen
2012-03-09 15:43 ` Lennart Sorensen
2012-03-09 15:47 ` Lennart Sorensen
2012-03-09 15:48 ` Vladimir 'φ-coder/phcoder' Serbinenko
[not found] ` <20120309160538.GA14853@caffeine.csclub.uwaterloo.ca>
2012-03-09 18:15 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-09 18:39 ` Lennart Sorensen
2012-03-09 20:37 ` Lennart Sorensen
2012-03-19 21:28 ` Lennart Sorensen
2012-03-20 10:28 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-20 19:02 ` Lennart Sorensen
2012-03-20 19:10 ` Vladimir 'φ-coder/phcoder' Serbinenko
2012-03-20 19:13 ` Lennart Sorensen
2012-03-20 19:14 ` Lennart Sorensen
2012-03-20 19:41 ` Lennart Sorensen
2012-03-20 19:11 ` Lennart Sorensen
2012-03-22 2:27 ` Fwd: " jlcenter
2012-03-22 2:46 ` NeilBrown
2012-03-22 17:52 ` Fwd: " jlcenter
2012-03-09 0:24 ` Vladimir 'φ-coder/phcoder' Serbinenko
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=4F52947C.3010500@gmail.com \
--to=phcoder@gmail.com \
--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 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.