From 05b7fe417073ef1d0b8542916d73f41e8ecfe730 Mon Sep 17 00:00:00 2001 From: Anusha Ragunathan Date: Tue, 19 Jul 2016 08:35:36 -0700 Subject: [PATCH] Remove extra map lookup for volume drivers. Signed-off-by: Anusha Ragunathan (cherry picked from commit 5d4627331ee0c685116b083e9f25f2644f0d1bd0) Signed-off-by: Tibor Vass --- volume/drivers/extpoint.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/volume/drivers/extpoint.go b/volume/drivers/extpoint.go index 785063dfff..3de897e16d 100644 --- a/volume/drivers/extpoint.go +++ b/volume/drivers/extpoint.go @@ -107,19 +107,15 @@ func lookup(name string) (volume.Driver, error) { return nil, fmt.Errorf("Error looking up volume plugin %s: %v", name, err) } - drivers.Lock() - defer drivers.Unlock() - if ext, ok := drivers.extensions[name]; ok { - return ext, nil - } - d := NewVolumeDriver(name, p.Client()) if err := validateDriver(d); err != nil { return nil, err } if p.IsLegacy() { + drivers.Lock() drivers.extensions[name] = d + drivers.Unlock() } return d, nil }