Commit c47ffb69 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Bug fix for creating VM on a shared node; watch for race condition

when creating proj/exp local directory.

Also a bug fix; LOCALROOTFS was not getting set to /local.
parent 41412a58
...@@ -47,6 +47,7 @@ use Exporter; ...@@ -47,6 +47,7 @@ use Exporter;
# Must come after package declaration! # Must come after package declaration!
use English; use English;
use Errno;
my $debug = 0; my $debug = 0;
...@@ -303,6 +304,7 @@ sub LOCALROOTFS() { ...@@ -303,6 +304,7 @@ sub LOCALROOTFS() {
if (JAILED()); if (JAILED());
return "$VARDIR/vms/local" return "$VARDIR/vms/local"
if (GENVNODE()); if (GENVNODE());
return "/local";
} }
# #
...@@ -2923,20 +2925,29 @@ sub genvnodesetup($;$$) ...@@ -2923,20 +2925,29 @@ sub genvnodesetup($;$$)
my $eiddir = LOCALROOTFS() . "/$pid/$eid"; my $eiddir = LOCALROOTFS() . "/$pid/$eid";
my $viddir = LOCALROOTFS() . "/$pid/$vid"; my $viddir = LOCALROOTFS() . "/$pid/$vid";
#
# Watch for EEXIST cause of concurrency on shared node hosts.
#
if (! -e $piddir) { if (! -e $piddir) {
mkdir($piddir, 0777) or if (! mkdir($piddir, 0777)) {
die("*** $0:\n". die("*** $0:\n".
" mkdir filed - $piddir: $!\n"); " mkdir filed - $piddir: $!\n")
if ($! != Errno::EEXIST());
}
} }
if (! -e $eiddir) { if (! -e $eiddir) {
mkdir($eiddir, 0777) or if (! mkdir($eiddir, 0777)) {
die("*** $0:\n". die("*** $0:\n".
" mkdir filed - $eiddir: $!\n"); " mkdir filed - $eiddir: $!\n")
if ($! != Errno::EEXIST());
}
} }
if (! -e $viddir) { if (! -e $viddir) {
mkdir($viddir, 0775) or if (!mkdir($viddir, 0775)) {
die("*** $0:\n". die("*** $0:\n".
" mkdir filed - $viddir: $!\n"); " mkdir filed - $viddir: $!\n")
if ($! != Errno::EEXIST());
}
} }
chmod(0777, $piddir); chmod(0777, $piddir);
chmod(0777, $eiddir); chmod(0777, $eiddir);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment