cli: Fix reboot race
After issuing the "reboot" command to the sut, fastpath was previously waiting 10 seconds before attempting to reconnect over ssh. The intent was to avoid a race window where the sut would still accept incoming ssh connections prior to rebooting. But this is rather hacky. It turns out that the "shutdown" command will create the file /run/nologin, which will prevent any new incoming connections prior to the shutdown. The command even supports -r for reboot. But alas, this only works when a shutdown time in the future is given (minimum future time is +1 minute). When using the "now" time, it doesn't create the magic file. We don't want to wait 1 minute every time we want to reboot. So let's keep using "reboot", but let's first create the magic file ourselves. With this in place we can remove the 10 second wait and start polling immediately. Much better! While I've never seen the original race in practice, removing the sleep would cause the problem. So theoretically a really loaded system could be slow enough for this to happen even with the 10 second wait. Fixes: 24ac285c ("cli: Implement "fastpath sut reboot" command") Signed-off-by:Ryan Roberts <ryan.roberts@arm.com>
Loading
Please register or sign in to comment