소스 검색

[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 7 년 전
부모
커밋
ee35b03583
1개의 변경된 파일18개의 추가작업 그리고 3개의 파일을 삭제
  1. 18
    3
      src/core/sanboot.c

+ 18
- 3
src/core/sanboot.c 파일 보기

498
 			/* Delay reopening attempts */
498
 			/* Delay reopening attempts */
499
 			sleep_fixed ( SAN_REOPEN_DELAY_SECS );
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
 			continue;
505
 			continue;
502
 		}
506
 		}
503
 
507
 
504
 		/* Initiate command */
508
 		/* Initiate command */
505
-		if ( ( rc = command ( sandev, params ) ) != 0 )
509
+		if ( ( rc = command ( sandev, params ) ) != 0 ) {
510
+			retries++;
506
 			continue;
511
 			continue;
512
+		}
507
 
513
 
508
 		/* Start expiry timer */
514
 		/* Start expiry timer */
509
 		start_timer_fixed ( &sandev->timer, SAN_COMMAND_TIMEOUT );
515
 		start_timer_fixed ( &sandev->timer, SAN_COMMAND_TIMEOUT );
513
 			step();
519
 			step();
514
 
520
 
515
 		/* Check command status */
521
 		/* Check command status */
516
-		if ( ( rc = sandev->command_rc ) != 0 )
522
+		if ( ( rc = sandev->command_rc ) != 0 ) {
523
+			retries++;
517
 			continue;
524
 			continue;
525
+		}
518
 
526
 
519
 		return 0;
527
 		return 0;
520
 
528
 
521
-	} while ( ++retries <= san_retries );
529
+	} while ( retries <= san_retries );
522
 
530
 
523
 	/* Sanity check */
531
 	/* Sanity check */
524
 	assert ( ! timer_running ( &sandev->timer ) );
532
 	assert ( ! timer_running ( &sandev->timer ) );
728
 		return -EADDRINUSE;
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
 	/* Read device capacity */
746
 	/* Read device capacity */
732
 	if ( ( rc = sandev_command ( sandev, sandev_command_read_capacity,
747
 	if ( ( rc = sandev_command ( sandev, sandev_command_read_capacity,
733
 				     NULL ) ) != 0 )
748
 				     NULL ) ) != 0 )

Loading…
취소
저장