]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/kern/emu/hostdisk.c (linux_find_partition): Give up
authorColin Watson <cjwatson@ubuntu.com>
Fri, 27 May 2011 12:52:21 +0000 (13:52 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Fri, 27 May 2011 12:52:21 +0000 (13:52 +0100)
after ten consecutive open failures.  Scanning all the way up to
10000 is excessive and can cause serious performance problems in
some configurations.
Fixes Ubuntu bug #787461.

ChangeLog
grub-core/kern/emu/hostdisk.c

index 198750f6acf73fdf58273d58b1419597212e7478..351700803da0db23eef32b8742763783147cc94b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-05-27  Colin Watson  <cjwatson@ubuntu.com>
+
+       * grub-core/kern/emu/hostdisk.c (linux_find_partition): Give up
+       after ten consecutive open failures.  Scanning all the way up to
+       10000 is excessive and can cause serious performance problems in
+       some configurations.
+       Fixes Ubuntu bug #787461.
+
 2011-05-21  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/disk/arc/arcdisk.c (reopen): Close old handle before
index d633059c38a9602e601fe6a7a54a27308e5c21f9..e404c4fea565934c032475c6c185a81f70e42373 100644 (file)
@@ -564,6 +564,7 @@ linux_find_partition (char *dev, grub_disk_addr_t sector)
   int i;
   char real_dev[PATH_MAX];
   struct linux_partition_cache *cache;
+  int missing = 0;
 
   strcpy(real_dev, dev);
 
@@ -602,7 +603,13 @@ linux_find_partition (char *dev, grub_disk_addr_t sector)
 
       fd = open (real_dev, O_RDONLY);
       if (fd == -1)
-       continue;
+       {
+         if (missing++ < 10)
+           continue;
+         else
+           return 0;
+       }
+      missing = 0;
       close (fd);
 
       start = find_partition_start (real_dev);