fix multilevel diskfilter detection after rev 5024
PATCH 1/1 fix multilevel diskfilter detection after rev 5024
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).
--- ChangeLog | 5 +++++ grub-core/disk/diskfilter.c | 29 +++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-)
ChangeLog +5 -0
@@ -1,3 +1,8 @@ +2013-06-08 Andrey Borzenkov <[email protected]> + + * grub-core/disk/diskfilter.c (scan_devices): Iteratively + rescan diskfilter devices until nothing new is found. + 2013-06-07 Andrey Borzenkov <[email protected]> * grub-core/script/execute.c (grub_script_execute_sourcecode): Split
grub-core/disk/diskfilter.c +21 -8
@@ -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
Signature · 1 line
tg: (ac72fb7..) u/diskfilter_multilevel_detect (depends on: master)
Quoted 6 lines · Andrey Borzenkov
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.
Do you mean raid on top of raid on top of raid? Otherwise I don't understand the problem.
Quoted 29 lines
Change scan to iteratively rescan volume list until nothing new was detected (or scan depth exceeded).
Signed-off-by Andrey Borzenkov <[email protected]>--- ChangeLog | 5 +++++ grub-core/disk/diskfilter.c | 29 +++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-)ChangeLog +5
-0@@ -1,3 +1,8 @@ +2013-06-08 Andrey Borzenkov <[email protected]> + + * grub-core/disk/diskfilter.c (scan_devices): Iteratively + rescan diskfilter devices until nothing new is found. + 2013-06-07 Andrey Borzenkov <[email protected]> * grub-core/script/execute.c (grub_script_execute_sourcecode): Splitgrub-core/disk/diskfilter.c +0
-0
grub-core/disk/diskfilter.c scan_disk (const char *name, int accept_diskfilter) · line 193
Quoted 6 lines
grub-core/disk/diskfilter.c +1
-0@@ -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 ;
Still need it. Consider raid on loopback where underlying OS may call into diskfilter again.
Quoted 46 lines
grub-core/disk/diskfilter.c +20
-8@@ -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
В Sun, 16 Jun 2013 03:57:08 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:
Quoted 9 lines · Andrey Borzenkov
Quoted 6 lines
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.
Do you mean raid on top of raid on top of raid? Otherwise I don't understand the problem.
Yes. Any configuration with more than two levels.
Quoted 85 lines
Quoted 29 lines
Change scan to iteratively rescan volume list until nothing new was detected (or scan depth exceeded).
Signed-off-by Andrey Borzenkov <[email protected]>--- ChangeLog | 5 +++++ grub-core/disk/diskfilter.c | 29 +++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-)ChangeLog +5
-0@@ -1,3 +1,8 @@ +2013-06-08 Andrey Borzenkov <[email protected]> + + * grub-core/disk/diskfilter.c (scan_devices): Iteratively + rescan diskfilter devices until nothing new is found. + 2013-06-07 Andrey Borzenkov <[email protected]> * grub-core/script/execute.c (grub_script_execute_sourcecode): Splitgrub-core/disk/diskfilter.c +0
-0grub-core/disk/diskfilter.c scan_disk (const char *name, int accept_diskfilter) · line 193
Quoted 6 lines
grub-core/disk/diskfilter.c +1
-0@@ -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 ;Still need it. Consider raid on loopback where underlying OS may call into diskfilter again.
Quoted 46 lines
grub-core/disk/diskfilter.c +20
-8@@ -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
Quoted 9 lines · Andrey Borzenkov
В Sun, 16 Jun 2013 03:57:08 +0200
Vladimir 'φ-coder/phcoder' Serbinenko <[email protected]> пишет:Quoted 6 lines · Andrey Borzenkov
Quoted 5 lines
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.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
This means that e.g. MD RAID on top of MD RAID is not found.
Do you mean raid on top of raid on top of raid? Otherwise I don't understand the problem.
Yes. Any configuration with more than two levels.
Ok, go ahead then.
Quoted 93 lines
Quoted 81 lines
Quoted 29 lines
Change scan to iteratively rescan volume list until nothing new was detected (or scan depth exceeded).
Signed-off-by Andrey Borzenkov <[email protected]>--- ChangeLog | 5 +++++ grub-core/disk/diskfilter.c | 29 +++++++++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-)ChangeLog +5
-0@@ -1,3 +1,8 @@ +2013-06-08 Andrey Borzenkov <[email protected]> + + * grub-core/disk/diskfilter.c (scan_devices): Iteratively + rescan diskfilter devices until nothing new is found. + 2013-06-07 Andrey Borzenkov <[email protected]> * grub-core/script/execute.c (grub_script_execute_sourcecode): Splitgrub-core/disk/diskfilter.c +0
-0grub-core/disk/diskfilter.c scan_disk (const char *name, int accept_diskfilter) · line 193
Quoted 6 lines
grub-core/disk/diskfilter.c +1
-0@@ -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 ;Still need it. Consider raid on loopback where underlying OS may call into diskfilter again.
Quoted 44 lines
grub-core/disk/diskfilter.c +20
-8@@ -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" ); }Quoted 4 lines
grub-core/disk/diskfilter.c scan_devices (const char *arname) · line 259
Quoted 2 lines
grub-core/disk/diskfilter.c +0
-0static int_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel