aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThomas Guillem <thomas@gllm.fr>2015-05-09 15:59:31 +0200
committerMax Kellermann <max@duempel.org>2015-05-29 22:39:14 +0200
commit3436a646b5a2fc181056fa44989e17ff1f6b083c (patch)
tree655c789c2d6e7dd39b1d29db406ad6dd45ddb257 /src
parentaed0af1e00b7d3f1bbe886a50cc140d01fc2bff8 (diff)
downloadmpd-3436a646b5a2fc181056fa44989e17ff1f6b083c.tar.gz
mpd-3436a646b5a2fc181056fa44989e17ff1f6b083c.tar.xz
mpd-3436a646b5a2fc181056fa44989e17ff1f6b083c.zip
storage/nfs: fix deadlock when connecting
The Connect method can be called between Schedule and lock. In that case, when locked, the state is already set to CONNECTING of READY and the condition won't be signaled anymore.
Diffstat (limited to 'src')
-rw-r--r--src/storage/plugins/NfsStorage.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx
index 324b40b6f..a1f079e2c 100644
--- a/src/storage/plugins/NfsStorage.cxx
+++ b/src/storage/plugins/NfsStorage.cxx
@@ -177,6 +177,8 @@ private:
mutex.unlock();
DeferredMonitor::Schedule();
mutex.lock();
+ if (state == State::INITIAL)
+ cond.wait(mutex);
break;
case State::CONNECTING:
@@ -188,8 +190,6 @@ private:
error.Set(last_error);
return false;
}
-
- cond.wait(mutex);
}
}