snapuserd: Fix race condition in MergeWorker::WaitForMergeBegin.

The pre-conditions and post-conditions to cv.wait() in this function are
different, which leads to a race. If the merge is never initiated, but
I/O is terminated, the wait() will hang.

This is easy to hit in tests where I/O terminates quickly, but should
not affect actual OTA flow in practice.

Bug: 269361087
Test: snapuserd_test
Change-Id: I85ed9c357031ec6fd74d6a3f49d85e6cbb037eee
1 file changed