grub: fix hang in netboot
PATCH 1/1 grub: fix hang in netboot
Grub can busy-loop and hang while network booting, if the network has some fair amount of activity. This is because grub's net module sniffs the network for packets, and busy-loops in receive_packets() till it finds network packet of type IP or IPV6. During this period grub will not respond to any user input, thus hanging up the system.
The following patch lets grub to relax every few iterations, so that it can respond to other user inputs.
grub-2.02~beta2/grub-core/net/net.c +2 -1
@@ -1500,10 +1500,11 @@ grub_net_poll_cards_idle_real (void)FOR_NET_CARDS (card) {grub_uint64_t ctime =grub_get_time_ms (); +int stop_condition =1 ;if (ctime < card->last_poll || ctime >= card->last_poll + card->idle_poll_delay_ms) -receive_packets (card,0 ); +receive_packets (card, &stop_condition); }grub_net_tcp_retransmit (); }
Quoted 18 lines · Ram Pai
Grub can busy-loop and hang while network booting, if the network has some fair amount of activity. This is because grub's net module sniffs the network for packets, and busy-loops in
receive_packets()till it finds network packet of type IP or IPV6. During this period grub will not respond to any user input, thus hanging up the system.The following patch lets grub to relax every few iterations, so that it can respond to other user inputs.
Signed-off-by Ram Pai <[email protected]>grub-2.02~beta2/grub-core/net/net.c +0
-0@@ -1500,10 +1500,11 @@ grub_net_poll_cards_idle_real (void)FOR_NET_CARDS (card) {
grub-2.02~beta2/grub-core/net/net.c grub_net_poll_cards_idle_real (void) · line 1510
Quoted 10 lines
grub-2.02~beta2/grub-core/net/net.c +2
-1grub_uint64_t ctime =grub_get_time_ms (); +int stop_condition =1 ;if (ctime < card->last_poll || ctime >= card->last_poll + card->idle_poll_delay_ms) -receive_packets (card,0 ); +receive_packets (card, &stop_condition); }grub_net_tcp_retransmit (); }
There is a patch by Paulo that fixes the same problem. http://marc.info/?l=grub-devel&m=139175231351317&w=2
Git commit d99d2f84166b0f60673d5c0714605a153946c0fc.
This patch is not needed, please ignore.
RP