mirror of
https://github.com/ipxe/ipxe
synced 2025-12-20 12:00:19 +03:00
[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>
This commit is contained in:
@@ -498,12 +498,18 @@ sandev_command ( struct san_device *sandev,
|
|||||||
/* Delay reopening attempts */
|
/* Delay reopening attempts */
|
||||||
sleep_fixed ( SAN_REOPEN_DELAY_SECS );
|
sleep_fixed ( SAN_REOPEN_DELAY_SECS );
|
||||||
|
|
||||||
|
/* Retry opening indefinitely for multipath devices */
|
||||||
|
if ( sandev->paths <= 1 )
|
||||||
|
retries++;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initiate command */
|
/* Initiate command */
|
||||||
if ( ( rc = command ( sandev, params ) ) != 0 )
|
if ( ( rc = command ( sandev, params ) ) != 0 ) {
|
||||||
|
retries++;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Start expiry timer */
|
/* Start expiry timer */
|
||||||
start_timer_fixed ( &sandev->timer, SAN_COMMAND_TIMEOUT );
|
start_timer_fixed ( &sandev->timer, SAN_COMMAND_TIMEOUT );
|
||||||
@@ -513,12 +519,14 @@ sandev_command ( struct san_device *sandev,
|
|||||||
step();
|
step();
|
||||||
|
|
||||||
/* Check command status */
|
/* Check command status */
|
||||||
if ( ( rc = sandev->command_rc ) != 0 )
|
if ( ( rc = sandev->command_rc ) != 0 ) {
|
||||||
|
retries++;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
} while ( ++retries <= san_retries );
|
} while ( retries <= san_retries );
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
assert ( ! timer_running ( &sandev->timer ) );
|
assert ( ! timer_running ( &sandev->timer ) );
|
||||||
@@ -728,6 +736,13 @@ int register_sandev ( struct san_device *sandev ) {
|
|||||||
return -EADDRINUSE;
|
return -EADDRINUSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check that device is capable of being opened (i.e. that all
|
||||||
|
* URIs are well-formed and that at least one path is
|
||||||
|
* working).
|
||||||
|
*/
|
||||||
|
if ( ( rc = sandev_reopen ( sandev ) ) != 0 )
|
||||||
|
return rc;
|
||||||
|
|
||||||
/* Read device capacity */
|
/* Read device capacity */
|
||||||
if ( ( rc = sandev_command ( sandev, sandev_command_read_capacity,
|
if ( ( rc = sandev_command ( sandev, sandev_command_read_capacity,
|
||||||
NULL ) ) != 0 )
|
NULL ) ) != 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user