diff options
author | Michael Brown | 2017-03-27 12:18:14 +0200 |
---|---|---|
committer | Michael Brown | 2017-03-27 14:41:22 +0200 |
commit | ee35b03583080f44ad63aebaadf1e9b4976f6605 (patch) | |
tree | d1113c48409aceae149c3ae75515f19a4fd34781 /src/core/sanboot.c | |
parent | [block] Add a small delay between attempts to reopen SAN targets (diff) | |
download | ipxe-ee35b03583080f44ad63aebaadf1e9b4976f6605.tar.gz ipxe-ee35b03583080f44ad63aebaadf1e9b4976f6605.tar.xz ipxe-ee35b03583080f44ad63aebaadf1e9b4976f6605.zip |
[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>
Diffstat (limited to 'src/core/sanboot.c')
-rw-r--r-- | src/core/sanboot.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/core/sanboot.c b/src/core/sanboot.c index efab3d02..8eb54b7c 100644 --- a/src/core/sanboot.c +++ b/src/core/sanboot.c @@ -498,12 +498,18 @@ sandev_command ( struct san_device *sandev, /* Delay reopening attempts */ sleep_fixed ( SAN_REOPEN_DELAY_SECS ); + /* Retry opening indefinitely for multipath devices */ + if ( sandev->paths <= 1 ) + retries++; + continue; } /* Initiate command */ - if ( ( rc = command ( sandev, params ) ) != 0 ) + if ( ( rc = command ( sandev, params ) ) != 0 ) { + retries++; continue; + } /* Start expiry timer */ start_timer_fixed ( &sandev->timer, SAN_COMMAND_TIMEOUT ); @@ -513,12 +519,14 @@ sandev_command ( struct san_device *sandev, step(); /* Check command status */ - if ( ( rc = sandev->command_rc ) != 0 ) + if ( ( rc = sandev->command_rc ) != 0 ) { + retries++; continue; + } return 0; - } while ( ++retries <= san_retries ); + } while ( retries <= san_retries ); /* Sanity check */ assert ( ! timer_running ( &sandev->timer ) ); @@ -728,6 +736,13 @@ int register_sandev ( struct san_device *sandev ) { 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 */ if ( ( rc = sandev_command ( sandev, sandev_command_read_capacity, NULL ) ) != 0 ) |