From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1LyZHS-0006tH-8g for mharc-grub-devel@gnu.org; Mon, 27 Apr 2009 18:26:30 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LyZHQ-0006sX-55 for grub-devel@gnu.org; Mon, 27 Apr 2009 18:26:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LyZHL-0006r0-Da for grub-devel@gnu.org; Mon, 27 Apr 2009 18:26:27 -0400 Received: from [199.232.76.173] (port=35313 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LyZHL-0006qu-7B for grub-devel@gnu.org; Mon, 27 Apr 2009 18:26:23 -0400 Received: from c60.cesmail.net ([216.154.195.49]:2757) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.60) (envelope-from ) id 1LyZHK-0001TD-Pc for grub-devel@gnu.org; Mon, 27 Apr 2009 18:26:23 -0400 Received: from unknown (HELO smtprelay2.cesmail.net) ([192.168.1.112]) by c60.cesmail.net with ESMTP; 27 Apr 2009 18:26:19 -0400 Received: from [192.168.0.22] (static-72-92-88-10.phlapa.fios.verizon.net [72.92.88.10]) by smtprelay2.cesmail.net (Postfix) with ESMTPSA id 3E03D34C6A for ; Mon, 27 Apr 2009 18:24:08 -0400 (EDT) From: Pavel Roskin To: The development of GRUB 2 In-Reply-To: <20090426.225757.05232059.davem@davemloft.net> References: <1240809937.4158.50.camel@ct> <20090426.225757.05232059.davem@davemloft.net> Content-Type: text/plain Date: Mon, 27 Apr 2009 18:26:11 -0400 Message-Id: <1240871171.11406.106.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1 (2.26.1-2.fc11) Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: Re: Revision 2136 breaks two-disk configuarion X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Apr 2009 22:26:28 -0000 On Sun, 2009-04-26 at 22:57 -0700, David Miller wrote: > grub_disk_open() isn't used, but a grub_device_open() does occur > during the iterator that has us find the FS_UUID device. This > happens search_fs_uuid(). > > If we don't do this, we leave a device reference open and dangling. Then we should be using grub_device_close(). I've made a patch that keeps dev, not disk in the data field. Unfortunately, the problem persists. I could easily reproduce it on another machine by using a flash drive and qemu. It's entirely possible that the problem is elsewhere. But I have no experience debugging memory problems in GRUB, so it will take time before I find out. Here's the patch. It doesn't make the memory problem go away, but it makes the code nicer by using the same abstraction to open and close the disk. diff --git a/disk/fs_uuid.c b/disk/fs_uuid.c index 9d83bb8..f590ad2 100644 --- a/disk/fs_uuid.c +++ b/disk/fs_uuid.c @@ -89,7 +89,7 @@ grub_fs_uuid_open (const char *name, grub_disk_t disk) disk->total_sectors = dev->disk->total_sectors; disk->has_partitions = 0; disk->partition = dev->disk->partition; - disk->data = dev->disk; + disk->data = dev; return GRUB_ERR_NONE; } @@ -97,24 +97,24 @@ grub_fs_uuid_open (const char *name, grub_disk_t disk) static void grub_fs_uuid_close (grub_disk_t disk __attribute((unused))) { - grub_disk_t parent = disk->data; - grub_disk_close (parent); + grub_device_t parent = disk->data; + grub_device_close (parent); } static grub_err_t grub_fs_uuid_read (grub_disk_t disk, grub_disk_addr_t sector, grub_size_t size, char *buf) { - grub_disk_t parent = disk->data; - return parent->dev->read (parent, sector, size, buf); + grub_device_t parent = disk->data; + return parent->disk->dev->read (parent->disk, sector, size, buf); } static grub_err_t grub_fs_uuid_write (grub_disk_t disk, grub_disk_addr_t sector, grub_size_t size, const char *buf) { - grub_disk_t parent = disk->data; - return parent->dev->write (parent, sector, size, buf); + grub_device_t parent = disk->data; + return parent->disk->dev->write (parent->disk, sector, size, buf); } static struct grub_disk_dev grub_fs_uuid_dev = -- Regards, Pavel Roskin