diff --git a/quota/lock.go b/quota/lock.go
index <HASH>..<HASH> 100644
--- a/quota/lock.go
+++ b/quota/lock.go
@@ -13,12 +13,13 @@ type multiLocker struct {
 
 func (l *multiLocker) Lock(name string) {
 	l.mut.Lock()
-	defer l.mut.Unlock()
-	_, ok := l.m[name]
+	mutex, ok := l.m[name]
 	if !ok {
-		l.m[name] = new(sync.Mutex)
+		mutex = new(sync.Mutex)
+		l.m[name] = mutex
 	}
-	l.m[name].Lock()
+	l.mut.Unlock()
+	mutex.Lock()
 }
 
 func (l *multiLocker) Unlock(name string) {
diff --git a/quota/lock_test.go b/quota/lock_test.go
index <HASH>..<HASH> 100644
--- a/quota/lock_test.go
+++ b/quota/lock_test.go
@@ -6,6 +6,7 @@ package quota
 
 import (
 	"launchpad.net/gocheck"
+	"runtime"
 	"sync"
 )
 
@@ -37,6 +38,7 @@ func (Suite) TestMultiLockerUsage(c *gocheck.C) {
 		locker.Unlock("user@tsuru.io")
 		wg.Done()
 	}()
+	runtime.Gosched()
 	c.Assert(count, gocheck.Equals, 0)
 	locker.Unlock("user@tsuru.io")
 	wg.Wait()
quota: fix dead lock on multiLocker

Apparently, I'm stupid...