init: add semantics for all types of backends running
authorLuis Chamberlain <mcgrof@kernel.org>
Tue, 21 Aug 2018 18:15:39 +0000 (12:15 -0600)
committerLuis Chamberlain <mcgrof@kernel.org>
Thu, 23 Aug 2018 17:02:35 +0000 (11:02 -0600)
commit24a9713081802d92cd5e195a28f6b62bb979a4a3
tree80f7963c20cf7bfea3c160515b97b637ed504c8d
parent1d1b65dc17c39f43dbe9d66062ca61fc3e90ddfc
init: add semantics for all types of backends running

Commit 67a176fc7 ("Fix segfault with client/server and minimal output")
addressed a segfault but it wasn't very clear *why* the fix was needed.
The reason it was needed is that the disk util and its respective
semaphore are only initialized when setup_disk_util() is called, this
happens upon fio_backend() calls. That is, either we have a dedicated
backend or have initiated a backend for the localhost due to some local
work. And show_thread_status() is currently called from a complete
client setup -- handle_ts() calls show_thread_status(), and a client
does not collect any local disk data, it receives this from the backend.
As such, the semaphore won't be setup in a client setup and this is why
we segfault here.

We can enable show_thread_status() then only if any type of backend is
running, however there is are no semantics currently which enable us to
query for this. Add such semantics and replace the previous check with
a check for if fio_backend() was ever called. This will make it clearer.

Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
backend.c
diskutil.c
fio.h
init.c
stat.c