* 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.
This commit is contained in:
Colin Watson 2011-05-27 13:52:21 +01:00
parent 245f4aba48
commit c64db050f7
2 changed files with 16 additions and 1 deletions

View File

@ -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

View 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);