diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-09-14 02:45:57 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-14 22:22:13 +0100 |
commit | 26e46e6d902a952fd884f61460ec11b8aca01917 (patch) | |
tree | 927e13132142c960e7ac6e9c82cd297aa2dd75a2 /scripts | |
parent | edc92ea8def507ee6cdc6fb2946ca444bc9461a6 (diff) | |
download | poky-26e46e6d902a952fd884f61460ec11b8aca01917.tar.gz |
runqemu: fix a race issue on lockdir
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'
(From OE-Core rev: ec33043477a0b915b0911f7d7eacb24361e4aaa8)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/runqemu | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 9af13f3360..b6bc0ba734 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -694,7 +694,12 @@ class BaseConfig(object): | |||
694 | raise Exception("runqemu-ifup, runqemu-ifdown or ip not found") | 694 | raise Exception("runqemu-ifup, runqemu-ifdown or ip not found") |
695 | 695 | ||
696 | if not os.path.exists(lockdir): | 696 | if not os.path.exists(lockdir): |
697 | os.mkdir(lockdir) | 697 | # There might be a race issue when multi runqemu processess are |
698 | # running at the same time. | ||
699 | try: | ||
700 | os.mkdir(lockdir) | ||
701 | except FileExistsError: | ||
702 | pass | ||
698 | 703 | ||
699 | cmd = '%s link' % ip | 704 | cmd = '%s link' % ip |
700 | logger.info('Running %s...' % cmd) | 705 | logger.info('Running %s...' % cmd) |