Procházet zdrojové kódy

[block] Retry reopening indefinitely for multipath devices

For multipath SAN devices, verify that the device is capable of being
opened (i.e. that all URIs are parseable and that at least one path is
alive) and thereafter retry indefinitely to reopen the device as
needed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown před 7 roky
rodič
revize
ee35b03583
1 změnil soubory, kde provedl 18 přidání a 3 odebrání
  1. 18
    3
      src/core/sanboot.c

+ 18
- 3
src/core/sanboot.c Zobrazit soubor

@@ -498,12 +498,18 @@ sandev_command ( struct san_device *sandev,
498 498
 			/* Delay reopening attempts */
499 499
 			sleep_fixed ( SAN_REOPEN_DELAY_SECS );
500 500
 
501
+			/* Retry opening indefinitely for multipath devices */
502
+			if ( sandev->paths <= 1 )
503
+				retries++;
504
+
501 505
 			continue;
502 506
 		}
503 507
 
504 508
 		/* Initiate command */
505
-		if ( ( rc = command ( sandev, params ) ) != 0 )
509
+		if ( ( rc = command ( sandev, params ) ) != 0 ) {
510
+			retries++;
506 511
 			continue;
512
+		}
507 513
 
508 514
 		/* Start expiry timer */
509 515
 		start_timer_fixed ( &sandev->timer, SAN_COMMAND_TIMEOUT );
@@ -513,12 +519,14 @@ sandev_command ( struct san_device *sandev,
513 519
 			step();
514 520
 
515 521
 		/* Check command status */
516
-		if ( ( rc = sandev->command_rc ) != 0 )
522
+		if ( ( rc = sandev->command_rc ) != 0 ) {
523
+			retries++;
517 524
 			continue;
525
+		}
518 526
 
519 527
 		return 0;
520 528
 
521
-	} while ( ++retries <= san_retries );
529
+	} while ( retries <= san_retries );
522 530
 
523 531
 	/* Sanity check */
524 532
 	assert ( ! timer_running ( &sandev->timer ) );
@@ -728,6 +736,13 @@ int register_sandev ( struct san_device *sandev ) {
728 736
 		return -EADDRINUSE;
729 737
 	}
730 738
 
739
+	/* Check that device is capable of being opened (i.e. that all
740
+	 * URIs are well-formed and that at least one path is
741
+	 * working).
742
+	 */
743
+	if ( ( rc = sandev_reopen ( sandev ) ) != 0 )
744
+		return rc;
745
+
731 746
 	/* Read device capacity */
732 747
 	if ( ( rc = sandev_command ( sandev, sandev_command_read_capacity,
733 748
 				     NULL ) ) != 0 )

Načítá se…
Zrušit
Uložit