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
91c3e281
Unverified
Commit
91c3e281
authored
Apr 15, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: improve log when mounting rootfs
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
df6a2945
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
conf.c
src/lxc/conf.c
+22
-16
No files found.
src/lxc/conf.c
View file @
91c3e281
...
@@ -916,29 +916,28 @@ static int mount_rootfs(const char *rootfs, const char *target, const char *opti
...
@@ -916,29 +916,28 @@ static int mount_rootfs(const char *rootfs, const char *target, const char *opti
};
};
if
(
!
realpath
(
rootfs
,
absrootfs
))
{
if
(
!
realpath
(
rootfs
,
absrootfs
))
{
SYSERROR
(
"
failed to get real path for '%s'
"
,
rootfs
);
SYSERROR
(
"
Failed to get real path for
\"
%s
\"
.
"
,
rootfs
);
return
-
1
;
return
-
1
;
}
}
if
(
access
(
absrootfs
,
F_OK
))
{
if
(
access
(
absrootfs
,
F_OK
))
{
SYSERROR
(
"
'%s' is not accessible
"
,
absrootfs
);
SYSERROR
(
"
Th rootfs
\"
%s
\"
is not accessible.
"
,
absrootfs
);
return
-
1
;
return
-
1
;
}
}
if
(
stat
(
absrootfs
,
&
s
))
{
if
(
stat
(
absrootfs
,
&
s
))
{
SYSERROR
(
"
failed to stat '%s'
"
,
absrootfs
);
SYSERROR
(
"
Failed to stat the rootfs
\"
%s
\"
.
"
,
absrootfs
);
return
-
1
;
return
-
1
;
}
}
for
(
i
=
0
;
i
<
sizeof
(
rtfs_type
)
/
sizeof
(
rtfs_type
[
0
]);
i
++
)
{
for
(
i
=
0
;
i
<
sizeof
(
rtfs_type
)
/
sizeof
(
rtfs_type
[
0
]);
i
++
)
{
if
(
!
__S_ISTYPE
(
s
.
st_mode
,
rtfs_type
[
i
].
type
))
if
(
!
__S_ISTYPE
(
s
.
st_mode
,
rtfs_type
[
i
].
type
))
continue
;
continue
;
return
rtfs_type
[
i
].
cb
(
absrootfs
,
target
,
options
);
return
rtfs_type
[
i
].
cb
(
absrootfs
,
target
,
options
);
}
}
ERROR
(
"
unsupported rootfs type for '%s'
"
,
absrootfs
);
ERROR
(
"
Unsupported rootfs type for rootfs
\"
%s
\"
.
"
,
absrootfs
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1304,38 +1303,45 @@ static int fill_autodev(const struct lxc_rootfs *rootfs, bool mount_console)
...
@@ -1304,38 +1303,45 @@ static int fill_autodev(const struct lxc_rootfs *rootfs, bool mount_console)
static
int
setup_rootfs
(
struct
lxc_conf
*
conf
)
static
int
setup_rootfs
(
struct
lxc_conf
*
conf
)
{
{
const
struct
lxc_rootfs
*
rootfs
=
&
conf
->
rootfs
;
struct
bdev
*
bdev
;
const
struct
lxc_rootfs
*
rootfs
;
rootfs
=
&
conf
->
rootfs
;
if
(
!
rootfs
->
path
)
{
if
(
!
rootfs
->
path
)
{
if
(
mount
(
""
,
"/"
,
NULL
,
MS_SLAVE
|
MS_REC
,
0
))
{
if
(
mount
(
""
,
"/"
,
NULL
,
MS_SLAVE
|
MS_REC
,
0
))
{
SYSERROR
(
"Failed to make / rslave"
);
SYSERROR
(
"Failed to make / rslave
.
"
);
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
}
}
if
(
access
(
rootfs
->
mount
,
F_OK
))
{
if
(
access
(
rootfs
->
mount
,
F_OK
))
{
SYSERROR
(
"
failed to access to '%s', check it is present
"
,
SYSERROR
(
"
Failed to access to
\"
%s
\"
. Check it is present.
"
,
rootfs
->
mount
);
rootfs
->
mount
);
return
-
1
;
return
-
1
;
}
}
/
/ First try mounting rootfs using a bdev
/
* First try mounting rootfs using a bdev. */
struct
bdev
*
bdev
=
bdev_init
(
conf
,
rootfs
->
path
,
rootfs
->
mount
,
rootfs
->
options
);
bdev
=
bdev_init
(
conf
,
rootfs
->
path
,
rootfs
->
mount
,
rootfs
->
options
);
if
(
bdev
&&
bdev
->
ops
->
mount
(
bdev
)
==
0
)
{
if
(
bdev
&&
!
bdev
->
ops
->
mount
(
bdev
)
)
{
bdev_put
(
bdev
);
bdev_put
(
bdev
);
DEBUG
(
"mounted '%s' on '%s'"
,
rootfs
->
path
,
rootfs
->
mount
);
DEBUG
(
"Mounted rootfs
\"
%s
\"
onto
\"
%s
\"
with options
\"
%s
\"
."
,
rootfs
->
path
,
rootfs
->
mount
,
rootfs
->
options
?
rootfs
->
options
:
"(null)"
);
return
0
;
return
0
;
}
}
if
(
bdev
)
if
(
bdev
)
bdev_put
(
bdev
);
bdev_put
(
bdev
);
if
(
mount_rootfs
(
rootfs
->
path
,
rootfs
->
mount
,
rootfs
->
options
))
{
if
(
mount_rootfs
(
rootfs
->
path
,
rootfs
->
mount
,
rootfs
->
options
))
{
ERROR
(
"failed to mount rootfs"
);
ERROR
(
"Failed to mount rootfs
\"
%s
\"
onto
\"
%s
\"
with options
\"
%s
\"
."
,
rootfs
->
path
,
rootfs
->
mount
,
rootfs
->
options
?
rootfs
->
options
:
"(null)"
);
return
-
1
;
return
-
1
;
}
}
DEBUG
(
"mounted '%s' on '%s'"
,
rootfs
->
path
,
rootfs
->
mount
);
DEBUG
(
"Mounted rootfs
\"
%s
\"
onto
\"
%s
\"
with options
\"
%s
\"
."
,
rootfs
->
path
,
rootfs
->
mount
,
rootfs
->
options
?
rootfs
->
options
:
"(null)"
);
return
0
;
return
0
;
}
}
...
...
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