From 84c406d5f55f16522bf8dafcb94576d6bb002107 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Thu, 25 Apr 2019 19:22:49 +0200
Subject: [PATCH] storage/nfs: use class ScopeUnlock

---
 src/storage/plugins/NfsStorage.cxx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

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;