diff --git a/ChangeLog b/ChangeLog index 136a78bb5..506b85dbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-12-15 Vladimir Serbinenko + + * grub-core/disk/loopback.c: Use sequential IDs rather than pointer. + + In case of quick removal of loopback and adding another one it may + get same ID, confusing the cache system. + 2013-12-15 Vladimir Serbinenko * grub-core/commands/acpi.c: Use grub_addr_t rather than long when diff --git a/grub-core/disk/loopback.c b/grub-core/disk/loopback.c index d9fa1f3c5..2d8deaeaf 100644 --- a/grub-core/disk/loopback.c +++ b/grub-core/disk/loopback.c @@ -32,9 +32,11 @@ struct grub_loopback char *devname; grub_file_t file; struct grub_loopback *next; + unsigned long id; }; static struct grub_loopback *loopback_list; +static unsigned long last_id = 0; static const struct grub_arg_option options[] = { @@ -120,6 +122,7 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args) } newdev->file = file; + newdev->id = last_id++; /* Add the new entry to the list. */ newdev->next = loopback_list; @@ -171,7 +174,7 @@ grub_loopback_open (const char *name, grub_disk_t disk) disk->max_agglomerate = 1 << (29 - GRUB_DISK_SECTOR_BITS - GRUB_DISK_CACHE_BITS); - disk->id = (unsigned long) dev; + disk->id = dev->id; disk->data = dev;