From 47282abfa41f90153454cd470c712b6c44517a06 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 17 Jun 2017 23:00:38 +0200 Subject: [PATCH] fuse: Use Mutex instead of RWMutex --- src/restic/fuse/snapshot.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/restic/fuse/snapshot.go b/src/restic/fuse/snapshot.go index 1b22ecd50..06bf41cbd 100644 --- a/src/restic/fuse/snapshot.go +++ b/src/restic/fuse/snapshot.go @@ -68,7 +68,7 @@ type SnapshotsDir struct { blobsize *BlobSizeCache // knownSnapshots maps snapshot timestamp to the snapshot - sync.RWMutex + sync.Mutex knownSnapshots map[string]SnapshotWithId processed restic.IDSet } @@ -141,9 +141,9 @@ func (sn *SnapshotsDir) updateCache(ctx context.Context) error { } func (sn *SnapshotsDir) get(name string) (snapshot SnapshotWithId, ok bool) { - sn.RLock() + sn.Lock() snapshot, ok = sn.knownSnapshots[name] - sn.RUnlock() + sn.Unlock() debug.Log("get(%s) -> %v %v", name, snapshot, ok) return snapshot, ok } @@ -155,8 +155,8 @@ func (sn *SnapshotsDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) { return nil, err } - sn.RLock() - defer sn.RUnlock() + sn.Lock() + defer sn.Unlock() ret := make([]fuse.Dirent, 0) for timestamp, snapshot := range sn.knownSnapshots {