Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
07a36a57
Commit
07a36a57
authored
May 06, 2014
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix package mount race condition.
parent
081daac5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
clientside/tmcc/linux/xen/libvnode_xen.pm
clientside/tmcc/linux/xen/libvnode_xen.pm
+24
-15
No files found.
clientside/tmcc/linux/xen/libvnode_xen.pm
View file @
07a36a57
...
@@ -774,13 +774,10 @@ sub vnodeCreate($$$$)
...
@@ -774,13 +774,10 @@ sub vnodeCreate($$$$)
mysystem2
("
$RESTOREVM
-t
$VMDIR
/
$vnode_id
$vnode_id
/mnt/
$imagename
");
mysystem2
("
$RESTOREVM
-t
$VMDIR
/
$vnode_id
$vnode_id
/mnt/
$imagename
");
if
(
$?
)
{
if
(
$?
)
{
mysystem2
("
umount /mnt/
$imagename
");
TBScriptUnlock
();
TBScriptUnlock
();
fatal
("
xen_vnodeCreate:
"
.
fatal
("
xen_vnodeCreate:
"
.
"
cannot restore logical volumes from
$imagename
");
"
cannot restore logical volumes from
$imagename
");
}
}
mysystem2
("
umount /mnt/
$imagename
");
if
(
$inreload
)
{
if
(
$inreload
)
{
libutil::
setState
("
RELOADDONE
");
libutil::
setState
("
RELOADDONE
");
sleep
(
4
);
sleep
(
4
);
...
@@ -2536,8 +2533,22 @@ sub createImageDisk($$$)
...
@@ -2536,8 +2533,22 @@ sub createImageDisk($$$)
my
$nochunks
=
0
;
my
$nochunks
=
0
;
my
$lv_size
;
my
$lv_size
;
#
# We are locked by the caller with a shared lock.
# We are locked by the caller with a shared lock.
#
# Need to promote to an exclusive lock.
#
TBScriptUnlock
();
if
(
TBScriptLock
(
$imagelockname
,
undef
,
1800
)
!=
TBSCRIPTLOCK_OKAY
())
{
print
STDERR
"
Could not get
$imagelockname
write lock
"
.
"
after a long time!
\n
";
return
-
1
;
}
# Ick.
if
(
exists
(
$raref
->
{'
MBRVERS
'})
&&
$raref
->
{'
MBRVERS
'}
==
99
)
{
$unpack
=
1
;
}
#
#
# Do we have the right image file already? No need to download it
# Do we have the right image file already? No need to download it
# again if the timestamp matches. Note that we are using the mod
# again if the timestamp matches. Note that we are using the mod
...
@@ -2555,21 +2566,19 @@ sub createImageDisk($$$)
...
@@ -2555,21 +2566,19 @@ sub createImageDisk($$$)
#
#
utime
(
time
(),
$mtime
,
$imagedatepath
);
utime
(
time
(),
$mtime
,
$imagedatepath
);
print
"
Found existing disk:
$lvmpath
.
\n
";
print
"
Found existing disk:
$lvmpath
.
\n
";
return
0
;
goto
bad
if
(
$unpack
&&
!
-
e
"
/mnt/
$image
"
&&
mysystem2
("
mkdir -p /mnt/
$image
"));
goto
bad
if
(
$unpack
&&
!
-
e
"
/mnt/
$image
/.mounted
"
&&
mysystem2
("
mount
$imagepath
/mnt/
$image
"));
goto
okay
;
}
}
print
"
mtime for
$lvmpath
differ: local
$mtime
, server
$tstamp
\n
";
print
"
mtime for
$lvmpath
differ: local
$mtime
, server
$tstamp
\n
";
}
}
}
}
#
# Need to promote to an exclusive lock.
#
TBScriptUnlock
();
if
(
TBScriptLock
(
$imagelockname
,
undef
,
1800
)
!=
TBSCRIPTLOCK_OKAY
())
{
print
STDERR
"
Could not get
$imagelockname
write lock
"
.
"
after a long time!
\n
";
return
-
1
;
}
if
(
findLVMLogicalVolume
(
$lvname
))
{
if
(
findLVMLogicalVolume
(
$lvname
))
{
# For the package case.
# For the package case.
if
(
-
e
"
/mnt/
$image
/.mounted
"
&&
mysystem2
("
umount /mnt/
$image
"))
{
if
(
-
e
"
/mnt/
$image
/.mounted
"
&&
mysystem2
("
umount /mnt/
$image
"))
{
...
@@ -2595,7 +2604,6 @@ sub createImageDisk($$$)
...
@@ -2595,7 +2604,6 @@ sub createImageDisk($$$)
# XXX Using MBRVERS for now, need something else.
# XXX Using MBRVERS for now, need something else.
#
#
if
(
exists
(
$raref
->
{'
MBRVERS
'})
&&
$raref
->
{'
MBRVERS
'}
==
99
)
{
if
(
exists
(
$raref
->
{'
MBRVERS
'})
&&
$raref
->
{'
MBRVERS
'}
==
99
)
{
$unpack
=
1
;
$lv_size
=
6
*
1024
;
$lv_size
=
6
*
1024
;
}
}
elsif
(
!
exists
(
$raref
->
{'
IMAGECHUNKS
'}))
{
elsif
(
!
exists
(
$raref
->
{'
IMAGECHUNKS
'}))
{
...
@@ -2713,6 +2721,7 @@ sub createImageDisk($$$)
...
@@ -2713,6 +2721,7 @@ sub createImageDisk($$$)
#
#
StoreImageMetadata
(
$image
,
$raref
);
StoreImageMetadata
(
$image
,
$raref
);
okay:
# And back to a shared lock.
# And back to a shared lock.
TBScriptUnlock
();
TBScriptUnlock
();
if
(
TBScriptLock
(
$imagelockname
,
TBSCRIPTLOCK_SHAREDLOCK
(),
1800
)
if
(
TBScriptLock
(
$imagelockname
,
TBSCRIPTLOCK_SHAREDLOCK
(),
1800
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment