Skip to content
Commit ec75fba0 authored by Ryan Roberts's avatar Ryan Roberts
Browse files

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's avatarRyan Roberts <ryan.roberts@arm.com>
parent 5ccfeb7d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment