From 3939c75345ae67f103d70dfffc17ea4f66912ede Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 6 Aug 2016 01:44:23 -0700 Subject: [PATCH] Added distributed RWMutex (#2369) --- cmd/namespace-lock.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/namespace-lock.go b/cmd/namespace-lock.go index 44cf0df87..b992c89a3 100644 --- a/cmd/namespace-lock.go +++ b/cmd/namespace-lock.go @@ -18,6 +18,7 @@ package cmd import ( "errors" + "github.com/minio/dsync" "sync" ) @@ -29,7 +30,7 @@ type nsParam struct { // nsLock - provides primitives for locking critical namespace regions. type nsLock struct { - sync.RWMutex + *dsync.DRWMutex ref uint } @@ -58,7 +59,8 @@ func (n *nsLockMap) lock(volume, path string, readLock bool) { nsLk, found := n.lockMap[param] if !found { nsLk = &nsLock{ - ref: 0, + DRWMutex: dsync.NewDRWMutex(volume + path), + ref: 0, } n.lockMap[param] = nsLk }