Skip to content

Commit cbf3e1c

Browse files
committed
LoopbackCache: make Close atomic
1 parent d516230 commit cbf3e1c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

fs/content_cache.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,9 @@ func (l *LoopbackCache) Open(id string) (*os.File, error) {
100100

101101
// Close closes the currently open fd
102102
func (l *LoopbackCache) Close(id string) {
103-
if fd, ok := l.fds.Load(id); ok {
103+
if fd, ok := l.fds.LoadAndDelete(id); ok {
104104
file := fd.(*os.File)
105105
file.Sync()
106106
file.Close()
107-
l.fds.Delete(id)
108107
}
109108
}

0 commit comments

Comments
 (0)