Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
aab6e3eb
Unverified
Commit
aab6e3eb
authored
Jul 07, 2019
by
Stéphane Graber
Committed by
GitHub
Jul 07, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3083 from brauner/2019-07-07/mount_api
lxccontainer: properly cleanup on mount injection failure
parents
9c238bc6
1f77c35e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
lxccontainer.c
src/lxc/lxccontainer.c
+13
-9
No files found.
src/lxc/lxccontainer.c
View file @
aab6e3eb
...
@@ -5117,33 +5117,37 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source,
...
@@ -5117,33 +5117,37 @@ static int do_lxcapi_mount(struct lxc_container *c, const char *source,
suff
=
strrchr
(
template
,
'/'
);
suff
=
strrchr
(
template
,
'/'
);
if
(
!
suff
)
if
(
!
suff
)
_exit
(
EXIT_FAILURE
)
;
goto
cleanup_target_in_child
;
ret
=
snprintf
(
path
,
sizeof
(
path
),
"%s%s"
,
c
->
lxc_conf
->
shmount
.
path_cont
,
suff
);
ret
=
snprintf
(
path
,
sizeof
(
path
),
"%s%s"
,
c
->
lxc_conf
->
shmount
.
path_cont
,
suff
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
path
))
{
if
(
ret
<
0
||
(
size_t
)
ret
>=
sizeof
(
path
))
{
SYSERROR
(
"Error writing container mountpoint name"
);
SYSERROR
(
"Error writing container mountpoint name"
);
_exit
(
EXIT_FAILURE
)
;
goto
cleanup_target_in_child
;
}
}
ret
=
mount
(
path
,
target
,
NULL
,
MS_MOVE
|
MS_REC
,
NULL
);
ret
=
mount
(
path
,
target
,
NULL
,
MS_MOVE
|
MS_REC
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to move the mount from
\"
%s
\"
to
\"
%s
\"
"
,
path
,
target
);
SYSERROR
(
"Failed to move the mount from
\"
%s
\"
to
\"
%s
\"
"
,
path
,
target
);
_exit
(
EXIT_FAILURE
)
;
goto
cleanup_target_in_child
;
}
}
TRACE
(
"Moved mount from
\"
%s
\"
to
\"
%s
\"
"
,
path
,
target
);
TRACE
(
"Moved mount from
\"
%s
\"
to
\"
%s
\"
"
,
path
,
target
);
_exit
(
EXIT_SUCCESS
);
_exit
(
EXIT_SUCCESS
);
cleanup_target_in_child
:
(
void
)
remove
(
target
);
_exit
(
EXIT_FAILURE
);
}
}
ret
=
wait_for_pid
(
pid
);
ret
=
wait_for_pid
(
pid
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
SYSERROR
(
"Wait for the child with pid %ld failed"
,
(
long
)
pid
);
SYSERROR
(
"Wait for the child with pid %ld failed"
,
(
long
)
pid
);
goto
out
;
else
}
ret
=
0
;
ret
=
0
;
if
(
umount2
(
template
,
MNT_DETACH
))
SYSWARN
(
"Failed to remove temporary mount
\"
%s
\"
"
,
template
);
(
void
)
umount2
(
template
,
MNT_DETACH
);
if
(
is_dir
)
if
(
is_dir
)
(
void
)
rmdir
(
template
);
(
void
)
rmdir
(
template
);
else
else
...
...
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