Skip to content

protect volumeStore Create() process with one entire lock#16473

Closed
x1022as wants to merge 1 commit intomoby:masterfrom
x1022as:dev
Closed

protect volumeStore Create() process with one entire lock#16473
x1022as wants to merge 1 commit intomoby:masterfrom
x1022as:dev

Conversation

@x1022as
Copy link
Contributor

@x1022as x1022as commented Sep 22, 2015

Signed-off-by: Deng Guangxing [email protected]

@x1022as
Copy link
Contributor Author

x1022as commented Sep 22, 2015

The former lock may be more scalable, but it is not safe.

Assume we create two volume simultaneously with the same name, the lock can not protect the create process.

@LK4D4
Copy link
Contributor

LK4D4 commented Sep 22, 2015

I think it was pretty safe. And real create command can take some time. Anyway ping @calavera @cpuguy83

@x1022as
Copy link
Contributor Author

x1022as commented Sep 22, 2015

@LK4D4 During the real create command which takes a long time, maybe another volume with same name is created. This could happen in very low probability though not completely impossible.

@coolljt0725
Copy link
Contributor

@LK4D4 I agree with @x1022as . I can reproduce this situation use volume plugin convoy which will take a long time to create a volume.
On a terminal type
docker volume create --name test -d convoy
which will take a few seconds to create a volume
At the same time on another terminal
docker volume create --name
which will create local volume immediately.
during the creation type docker volume ls the driver is different.

$ docker volume ls
DRIVER              VOLUME NAME
local               test
$ docker volume ls
DRIVER              VOLUME NAME
convoy              test

I think this PR is need.

@calavera
Copy link
Contributor

LGTM

@cpuguy83
Copy link
Member

The issue is that it will block all volume creates due to a slow or down volume driver.

@thaJeztah
Copy link
Member

Maybe registering the name and creating the volume should be separate? Will probably need a "state" for the volume ("creating"), and if the actual create fails for some reason, the name can be released

@x1022as
Copy link
Contributor Author

x1022as commented Sep 23, 2015

Maybe use per-volume lock instead of a global one to protect these volume operation? Lock with finer granularity will increase scalability.

@jessfraz
Copy link
Contributor

any updates here?

@cpuguy83
Copy link
Member

Closing in favor of #17185

With this, we'll end up with a deadlock when trying to containerize a volume driver.

@cpuguy83 cpuguy83 closed this Oct 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants