diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index e485fd8e4..26854884d 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -173,9 +173,11 @@ private: switch (state) { case State::INITIAL: /* schedule connect */ - mutex.unlock(); - defer_connect.Schedule(); - mutex.lock(); + { + const ScopeUnlock unlock(mutex); + defer_connect.Schedule(); + } + if (state == State::INITIAL) cond.wait(mutex); break;