All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 1/1] runqemu: fix a race issue on lockdir
Date: Wed, 14 Sep 2016 02:45:57 -0700	[thread overview]
Message-ID: <15e39e64de8fb94a3e22f6580bc94be28f7ea54e.1473846326.git.liezhi.yang@windriver.com> (raw)
In-Reply-To: <cover.1473846326.git.liezhi.yang@windriver.com>

There might be a race issue when multi runqemu processess are
running at the same time:
| Traceback (most recent call last):
|   File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 920, in <module>
|     ret = main()
|   File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 911, in main
|     config.setup_network()
|   File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 760, in setup_network
|     self.setup_tap()
|   File "/home/pokybuild/yocto-autobuilder/yocto-worker/nightly-ipk/build/scripts/runqemu", line 697, in setup_tap
|     os.mkdir(lockdir)
| FileExistsError: [Errno 17] File exists: '/tmp/qemu-tap-locks'

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 scripts/runqemu | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index 9af13f3..b6bc0ba 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -694,7 +694,12 @@ class BaseConfig(object):
             raise Exception("runqemu-ifup, runqemu-ifdown or ip not found")
 
         if not os.path.exists(lockdir):
-            os.mkdir(lockdir)
+            # There might be a race issue when multi runqemu processess are
+            # running at the same time.
+            try:
+                os.mkdir(lockdir)
+            except FileExistsError:
+                pass
 
         cmd = '%s link' % ip
         logger.info('Running %s...' % cmd)
-- 
2.9.0



      reply	other threads:[~2016-09-14  9:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  9:45 [PATCH 0/1] runqemu: fix a race issue on lockdir Robert Yang
2016-09-14  9:45 ` Robert Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15e39e64de8fb94a3e22f6580bc94be28f7ea54e.1473846326.git.liezhi.yang@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.