Just wait until the lock is available.  That is a nicer behavior for
concurrent (scripted) lxc-create's.

Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>
---
 templates/lxc-altlinux.in     |    4 ++--
 templates/lxc-debian.in       |    4 ++--
 templates/lxc-fedora.in       |    4 ++--
 templates/lxc-lenny.in        |    4 ++--
 templates/lxc-opensuse.in     |    4 ++--
 templates/lxc-ubuntu-cloud.in |    2 +-
 templates/lxc-ubuntu.in       |    2 +-
 7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/templates/lxc-altlinux.in b/templates/lxc-altlinux.in
index 3aba77b..35407d0 100644
--- a/templates/lxc-altlinux.in
+++ b/templates/lxc-altlinux.in
@@ -198,7 +198,7 @@ install_altlinux()
 {
     mkdir -p /var/lock/subsys/
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? -ne 0 ]; then
            echo "Cache repository is busy."
            return 1
@@ -314,7 +314,7 @@ clean()
 
     # lock, so we won't purge while someone is creating a repository
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? != 0 ]; then
            echo "Cache repository is busy."
            exit 1
diff --git a/templates/lxc-debian.in b/templates/lxc-debian.in
index b97bbac..48d0281 100644
--- a/templates/lxc-debian.in
+++ b/templates/lxc-debian.in
@@ -153,7 +153,7 @@ install_debian()
     rootfs=$1
     mkdir -p @LOCALSTATEDIR@/lock/subsys/
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? -ne 0 ]; then
            echo "Cache repository is busy."
            return 1
@@ -234,7 +234,7 @@ clean()
 
     # lock, so we won't purge while someone is creating a repository
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? != 0 ]; then
            echo "Cache repository is busy."
            exit 1
diff --git a/templates/lxc-fedora.in b/templates/lxc-fedora.in
index 3f50895..f9a9d0b 100644
--- a/templates/lxc-fedora.in
+++ b/templates/lxc-fedora.in
@@ -190,7 +190,7 @@ install_fedora()
 {
     mkdir -p /var/lock/subsys/
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? -ne 0 ]; then
            echo "Cache repository is busy."
            return 1
@@ -284,7 +284,7 @@ clean()
 
     # lock, so we won't purge while someone is creating a repository
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? != 0 ]; then
            echo "Cache repository is busy."
            exit 1
diff --git a/templates/lxc-lenny.in b/templates/lxc-lenny.in
index 3720dce..56cee73 100644
--- a/templates/lxc-lenny.in
+++ b/templates/lxc-lenny.in
@@ -142,7 +142,7 @@ install_debian()
     rootfs=$1
     mkdir -p @LOCALSTATEDIR@/lock/subsys/
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? -ne 0 ]; then
            echo "Cache repository is busy."
            return 1
@@ -222,7 +222,7 @@ clean()
 
     # lock, so we won't purge while someone is creating a repository
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? != 0 ]; then
            echo "Cache repository is busy."
            exit 1
diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in
index 120b2c7..1c166e8 100644
--- a/templates/lxc-opensuse.in
+++ b/templates/lxc-opensuse.in
@@ -217,7 +217,7 @@ install_opensuse()
     rootfs=$1
     mkdir -p /var/lock/subsys/
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? -ne 0 ]; then
            echo "Cache repository is busy."
            return 1
@@ -303,7 +303,7 @@ clean()
 
     # lock, so we won't purge while someone is creating a repository
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? != 0 ]; then
            echo "Cache repository is busy."
            exit 1
diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in
index 267dbab..8a46651 100644
--- a/templates/lxc-ubuntu-cloud.in
+++ b/templates/lxc-ubuntu-cloud.in
@@ -227,7 +227,7 @@ filename=`basename $url2`
 
 mkdir -p /var/lock/subsys/
 (
-    flock -n -x 200
+    flock -x 200
 
     cd $cache
     if [ $flushcache -eq 1 ]; then
diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index 822554f..bd448f6 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -212,7 +212,7 @@ install_ubuntu()
     cache="/var/cache/lxc/$release"
     mkdir -p /var/lock/subsys/
     (
-       flock -n -x 200
+       flock -x 200
        if [ $? -ne 0 ]; then
            echo "Cache repository is busy."
            return 1
-- 
1.7.9.5


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to