Просмотр исходного кода

[block] Add a small delay between attempts to reopen SAN targets

When all SAN targets are completely unreachable, there will be a
natural delay between reopening attempts due to the network connection
timeout on the unreachable targets.

However, some SAN targets may accept connections instantly and report
a temporary unavailability by e.g. failing the TEST UNIT READY
command.  If all targets are behaving this way then there will be no
natural delay, and we will attempt to saturate the network with
connection attempts.

Fix by introducing a small delay between attempts.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 лет назад
Родитель
Сommit
164378fee6
1 измененных файлов: 14 добавлений и 0 удалений
  1. 14
    0
      src/core/sanboot.c

+ 14
- 0
src/core/sanboot.c Просмотреть файл

74
  */
74
  */
75
 #define SAN_DEFAULT_RETRIES 10
75
 #define SAN_DEFAULT_RETRIES 10
76
 
76
 
77
+/**
78
+ * Delay between reopening attempts
79
+ *
80
+ * Some SAN targets will always accept connections instantly and
81
+ * report a temporary unavailability by e.g. failing the TEST UNIT
82
+ * READY command.  Avoid bombarding such targets by introducing a
83
+ * small delay between attempts.
84
+ */
85
+#define SAN_REOPEN_DELAY_SECS 5
86
+
77
 /** List of SAN devices */
87
 /** List of SAN devices */
78
 LIST_HEAD ( san_devices );
88
 LIST_HEAD ( san_devices );
79
 
89
 
484
 		/* Reopen block device if applicable */
494
 		/* Reopen block device if applicable */
485
 		if ( sandev_needs_reopen ( sandev ) &&
495
 		if ( sandev_needs_reopen ( sandev ) &&
486
 		     ( ( rc = sandev_reopen ( sandev ) ) != 0 ) ) {
496
 		     ( ( rc = sandev_reopen ( sandev ) ) != 0 ) ) {
497
+
498
+			/* Delay reopening attempts */
499
+			sleep_fixed ( SAN_REOPEN_DELAY_SECS );
500
+
487
 			continue;
501
 			continue;
488
 		}
502
 		}
489
 
503
 

Загрузка…
Отмена
Сохранить