devserver: Add locking around metadata read and write.

A race condition between reading and writing to the
metadata file is causing update failures in the CQ.

Use a file lock to protect both reads and writes.

BUG=chromium:554773

Change-Id: I4db224412ae3f5dfb045d99d90662a7c420cbcdb
Reviewed-on: https://chromium-review.googlesource.com/316913
Commit-Ready: Matthew Sartori <msartori@chromium.org>
Tested-by: Matthew Sartori <msartori@chromium.org>
Reviewed-by: Dan Shi <dshi@google.com>
1 file changed