~darkmuggle-deactivatedaccount/ubuntu/quantal/grub2/fix-872244

« back to all changes in this revision

Viewing changes to debian/patches/ubuntu_probe_dmraid.patch

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2011-09-14 13:10:54 UTC
  • Revision ID: package-import@ubuntu.com-20110914131054-vux9f5r8nx2eiepv
Tags: 1.99-12ubuntu2
Handle probing striped DM-RAID devices (thanks, Robert Collins;
LP: #803658).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Handle probing striped DM-RAID devices
 
2
Author: Robert Collins <robertc@robertcollins.net>
 
3
Bug-Ubuntu: https://bugs.launchpad.net/bugs/803658
 
4
Forwarded: no
 
5
Last-Update: 2011-09-14
 
6
 
 
7
Index: b/grub-core/kern/emu/hostdisk.c
 
8
===================================================================
 
9
--- a/grub-core/kern/emu/hostdisk.c
 
10
+++ b/grub-core/kern/emu/hostdisk.c
 
11
@@ -457,9 +457,15 @@
 
12
        grub_dprintf ("hostdisk", "no dm target\n");
 
13
        goto devmapper_fail;
 
14
       }
 
15
-    if (strcmp (target_type, "linear") != 0)
 
16
+    if (strcmp (target_type, "striped") == 0)
 
17
       {
 
18
-       grub_dprintf ("hostdisk", "ignoring dm target %s (not linear)\n",
 
19
+       grub_dprintf ("hostdisk", "treating dm target %s (striped) as real disk\n", dev);
 
20
+       return 0;
 
21
+      }
 
22
+    if (strcmp (target_type, "linear") != 0 &&
 
23
+       strcmp (target_type, "striped") != 0 )
 
24
+      {
 
25
+       grub_dprintf ("hostdisk", "ignoring dm target %s (not linear/striped)\n",
 
26
                      target_type);
 
27
        goto devmapper_fail;
 
28
       }
 
29
@@ -1469,6 +1475,11 @@
 
30
              grub_dprintf ("hostdisk", "%s child has no DM name\n", path);
 
31
              goto devmapper_out;
 
32
            }
 
33
+         if (strstr (child_name, "-") != 0)
 
34
+           {
 
35
+             grub_dprintf ("hostdisk", "%s child %s looks like a sub-layer\n", path, child_name);
 
36
+             goto devmapper_out;
 
37
+           }
 
38
          mapper_name = child_name;
 
39
 
 
40
 devmapper_out:
 
41
@@ -1575,6 +1586,16 @@
 
42
 
 
43
   if (os_dev[len - 1] < '0' || os_dev[len - 1] > '9')
 
44
     return 1;
 
45
+  /* dmraid devices are enumerated - e.g. /dev/mapper/isw_myuuidNAME0 but
 
46
+     still whole disk.  An initial heuristic follows:
 
47
+     They are a whole disk device if and only if:
 
48
+       - the name starts with /dev/mapper/
 
49
+       - the name does not contain '-' (so "NAME0-0") will not count
 
50
+       - we ignore partitions ("NAME0p1") because they return non-zero
 
51
+        partition offsets and device_is_wholedisk is not called.  */
 
52
+  if (strncmp (os_dev, "/dev/mapper/", sizeof ("/dev/mapper/") - 1) == 0 &&
 
53
+      strstr (os_dev + sizeof ("/dev/mapper/") - 1, "-") == 0)
 
54
+    return 1;
 
55
   return 0;
 
56
 }
 
57
 #endif