From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UlDKE-00055o-8Q for mharc-grub-devel@gnu.org; Sat, 08 Jun 2013 03:12:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlDK9-00053E-SR for grub-devel@gnu.org; Sat, 08 Jun 2013 03:12:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UlDK7-0003bI-Us for grub-devel@gnu.org; Sat, 08 Jun 2013 03:12:29 -0400 Received: from mail-la0-x234.google.com ([2a00:1450:4010:c03::234]:48540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlDK7-0003b4-Nu for grub-devel@gnu.org; Sat, 08 Jun 2013 03:12:27 -0400 Received: by mail-la0-f52.google.com with SMTP id fo12so2488849lab.39 for ; Sat, 08 Jun 2013 00:12:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer; bh=kH9hjExGBjbrnI+0nTwpZ+VnpRQdNlkPhTVfpSwHwAo=; b=ApyAvvUJC8voHbaQmt+QnTHP7YPAwFekxR1MuLHmwqxPiaxiRWToz5k6YFk1w2uhXz 9oXnoPrzuIzrQApFZTQ1zB2w0U1qb2cpVj0iiL089TXEEkB+tIlke38OemggfdDZyyTc Luq7ILn9tNMlpZqUvBsAlVJ0SW5VEKrxpuhjSpQsZ4jvLPS131ON1lw2uiTvLPQjRBE1 0xXdGdKmHtqCy2hwGfx1p7Ypo89I1rOpvWWBBzFzGjuoh5nBzYBTJdgBJmK5eZ+sMmi0 WQ6Z2XDkTd/hDGJ4XOCFyZTEG378EwMXu+VrSX2kKDlg0EXg/jRmq7KrwQ2BmkfJ/XNl hIbw== X-Received: by 10.152.22.232 with SMTP id h8mr957275laf.0.1370675546883; Sat, 08 Jun 2013 00:12:26 -0700 (PDT) Received: from localhost.localdomain (ppp79-139-160-84.pppoe.spdop.ru. [79.139.160.84]) by mx.google.com with ESMTPSA id n1sm727532lae.0.2013.06.08.00.12.26 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 08 Jun 2013 00:12:26 -0700 (PDT) From: Andrey Borzenkov To: grub-devel@gnu.org Subject: [PATCH] fix multilevel diskfilter detection after rev 5024 Date: Sat, 8 Jun 2013 11:12:19 +0400 Message-Id: <1370675539-31143-1-git-send-email-arvidjaar@gmail.com> X-Mailer: git-send-email 1.8.1.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c03::234 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jun 2013 07:12:31 -0000 After commit "Fix order to discover ambigouos RAID before discovering RAIDs on top of it" diskfilter scans all volumes exactly once. This means that only first level is found. Scanning second time will find next level etc. This means that e.g. MD RAID on top of MD RAID is not found. Change scan to iteratively rescan volume list until nothing new was detected (or scan depth exceeded). Signed-off-by: Andrey Borzenkov --- ChangeLog | 5 +++++ grub-core/disk/diskfilter.c | 29 +++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d8f343..bebcc8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2013-06-08 Andrey Borzenkov + + * grub-core/disk/diskfilter.c (scan_devices): Iteratively + rescan diskfilter devices until nothing new is found. + 2013-06-07 Andrey Borzenkov * grub-core/script/execute.c (grub_script_execute_sourcecode): Split diff --git a/grub-core/disk/diskfilter.c b/grub-core/disk/diskfilter.c index c8d267a..0455177 100644 --- a/grub-core/disk/diskfilter.c +++ b/grub-core/disk/diskfilter.c @@ -188,6 +188,7 @@ scan_disk (const char *name, int accept_diskfilter) if (!accept_diskfilter && is_valid_diskfilter_name (name)) return 0; + /* FIXME do we still need it? It is not called recursively anymore */ if (scan_depth > 100) return 0; @@ -219,6 +220,8 @@ scan_devices (const char *arname) grub_disk_pull_t pull; struct grub_diskfilter_vg *vg; struct grub_diskfilter_lv *lv = NULL; + int scan_depth; + int need_rescan; for (pull = 0; pull < GRUB_DISK_PULL_MAX; pull++) for (p = grub_disk_dev_list; p; p = p->next) @@ -231,16 +234,26 @@ scan_devices (const char *arname) return; } - for (vg = array_list; vg; vg = vg->next) + scan_depth = 0; + need_rescan = 1; + while (need_rescan && scan_depth++ < 100) { - if (vg->lvs) - for (lv = vg->lvs; lv; lv = lv->next) - if (!lv->scanned && lv->fullname && lv->became_readable_at) - { - scan_disk (lv->fullname, 1); - lv->scanned = 1; - } + need_rescan = 0; + for (vg = array_list; vg; vg = vg->next) + { + if (vg->lvs) + for (lv = vg->lvs; lv; lv = lv->next) + if (!lv->scanned && lv->fullname && lv->became_readable_at) + { + scan_disk (lv->fullname, 1); + lv->scanned = 1; + need_rescan = 1; + } + } } + + if (need_rescan) + grub_error (GRUB_ERR_UNKNOWN_DEVICE, "DISKFILTER scan depth exceeded"); } static int -- tg: (ac72fb7..) u/diskfilter_multilevel_detect (depends on: master)