Wrap all state-dependent method in job_state with a decorator that
ensures that file access is properly serialized and that the
in-memory and on-disk state are correctly synchronized at the start
and end of the method.

Note that this specifically does not address:
 1) thread safety
 2) race conditions involving multiple processes trying to alter the
    same state
In both these cases the offending code need to do its own locking. I
don't recommend doing either one, in any case.

The main use case this is trying to address is to ensure that state
set in child processes propogates back up to the parent processes.
In particular, we want to make sure that state set in a client test
propogates back up to the client job code, since the client test is
run in a forked subprocess.

Risk: Low
Visibility: Eliminates a variety of cross-process job state issues.

Signed-off-by: John Admanski <jadmanski@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@4168 592f7852-d20e-0410-864c-8624ca9c26a4
2 files changed