Skip to contentSkip to conversation

just skip over invalid/unsupported RAID

PATCH In review Felix Zielcke 2 participants 5 messages Aug 11, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 just skip over invalid/unsupported RAID

I said this already on Bean's RAID topic, but I think I just make now a new topic instead of messing him's up.

So here's again a patch which changes grub_error into grub_dprintf, it's the same reason as with these invalid BSD disklabels/partitions

See [0] for a good reason.
GRUB shouldn't fail to rescue mode, if an unsupport RAID (in this case
6) is used on disks which GRUB doestn't even need to access. Reporter has / and /boot on a raid1 and his raid6 is at the time of the report not even mounted.

I wasn't that sure about the last case, I changed. I had this too with my raid 1 experiments, as I forgot to --zero-superblock the second disk.

Normaly it sohuld never happen that you have more disks for an array as the super block says you have.

[0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=494501

2008-08-11 Felix Zielcke <[email protected]>

* disk/raid.c (grub_raid_scan_device): Do not abort on unsupported RAID levels or if something is wrong, use grub_dprintf to issue a warning.

raid.c +4 -4
Index: disk/raid.c
===================================================================
@@ -383,7 +383,7 @@
   /* FIXME: Also support version 1.0. */
   if (sb.major_version != 0 || sb.minor_version != 90)
     {
-      grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+      grub_dprintf ("raid",
 		  "Unsupported RAID version: %d.%d",
 		  sb.major_version, sb.minor_version);
       return 0;
@@ -394,7 +394,7 @@
   /* FIXME: Support all RAID levels.  */
   if (sb.level != 0 && sb.level != 1 && sb.level != 5)
     {
-      grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+      grub_dprintf ("raid",
 		  "Unsupported RAID level: %d",
 		  sb.level);
       return 0;
@@ -403,7 +403,7 @@
   /* FIXME: Support all layouts.  */
   if (sb.level == 5 && sb.layout != 2)
     {
-      grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
+      grub_dprintf ("raid",
 		  "Unsupported RAID5 layout: %d",
 		  sb.layout);
       return 0;
@@ -434,7 +434,7 @@
 	     happen normally, but what is the sanest things to do in such
 	     a case? */
 	     
-	  grub_error (GRUB_ERR_BAD_NUMBER,
+	  grub_dprintf ("raid",
 		      "array->nr_devs > array->total_devs (%d)?!?",
 		      array->total_devs);
 
#1 lore raw
Quoted 2 lines · Felix Zielcke

GRUB shouldn't fail to rescue mode, if an unsupport RAID (in this case
6) is used on disks which GRUB doestn't even need to access.

I think the right solution for this would be to handle the errors in the upper layer instead of removing them.

In this case, grub_raid_scan_device() is called from GRUB_MOD_INIT(raid), which doesn't handle them, and then when they're handled the only option is to abort normal mode.

GRUB_MOD_INIT(raid) could handle them just fine, with something like:

  grub_print_error ();
  grub_errno = GRUB_ERR_NONE;

if an error was found.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw

Am Montag, den 11.08.2008, 16:28 +0200 schrieb Robert Millan:

Quoted 7 lines

GRUB_MOD_INIT(raid) could handle them just fine, with something like:

  grub_print_error ();
  grub_errno = GRUB_ERR_NONE;

if an error was found.

Thanks for your hint, this is now something I thought initially with the invalid BSD partitions.
Showing an error but not aborting the whole thing.
Attached is now a patch wich just adds these 2 things.

I should really take me the time to just look at the Sourcecode and trying to understand it :)

I don't care much about the changelog, if you e.g. don't like the 2nd sentence then just remove it please on commit.

2008-08-11 Felix Zielcke <[email protected]>

* disk/raid.c (GRUB_MOD_INIT): Use grub_print_error() to show RAID errors and reset grub_errno. Do not give errors to the underlying layer.

raid.c +2 -0
Index: disk/raid.c
===================================================================
@@ -581,6 +581,8 @@
 {
   grub_device_iterate (&grub_raid_scan_device);
   grub_disk_dev_register (&grub_raid_dev);
+  grub_print_error();
+  grub_errno = GRUB_ERR_NONE;
 }
 
 GRUB_MOD_FINI(raid)
#3 lore raw
Quoted 6 lines · Felix Zielcke

Am Montag, den 11.08.2008, 16:28 +0200 schrieb Robert Millan:

Quoted 5 lines

GRUB_MOD_INIT(raid) could handle them just fine, with something like:

  grub_print_error ();
  grub_errno = GRUB_ERR_NONE;
Quoted 6 lines
Quoted 2 lines

if an error was found.

Thanks for your hint, this is now something I thought initially with the invalid BSD partitions.
Showing an error but not aborting the whole thing.

IIRC, the difference is that with the invalid BSD partitions, rising errors is ineffective as there can't be anyone to handle them (since we're inside an iteration).

Quoted 8 lines

I don't care much about the changelog, if you e.g. don't like the 2nd sentence then just remove it please on commit.

2008-08-11 Felix Zielcke <[email protected]>

* disk/raid.c (GRUB_MOD_INIT): Use grub_print_error() to show RAID errors and reset grub_errno. Do not give errors to the underlying layer.

That'd be the upper layer. E.g.

(normal mode)

        |
        V
(GRUB_MOD_INIT(raid))
        |
        V

(grub_raid_scan_device)

Quoted 1 line

+ grub_print_error();

Missing space here (before the parenthesis).

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#4 lore raw

Am Montag, den 11.08.2008, 23:22 +0200 schrieb Robert Millan:

Quoted 4 lines

IIRC, the difference is that with the invalid BSD partitions, rising errors is ineffective as there can't be anyone to handle them (since we're inside an iteration).

Ah, yes that's a `little' difference between that and the RAID module.

Quoted 1 line

That'd be the upper layer. E.g.

Right

Quoted 3 lines
Quoted 1 line

+ grub_print_error();

Missing space here (before the parenthesis).

Yeah, right.
I'm still not that used to it. I never did that before on my own code, but I think a space there isn't that bad :)

2008-08-11 Felix Zielcke <[email protected]>

* disk/raid.c (GRUB_MOD_INIT): Use grub_print_error() to show RAID errors and reset grub_errno. Do not give errors to the upper layer.

raid.c +2 -0
Index: disk/raid.c
===================================================================
@@ -581,6 +581,8 @@
 {
   grub_device_iterate (&grub_raid_scan_device);
   grub_disk_dev_register (&grub_raid_dev);
+  grub_print_error ();
+  grub_errno = GRUB_ERR_NONE;
 }
 
 GRUB_MOD_FINI(raid)