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
0ac4b28a
Unverified
Commit
0ac4b28a
authored
Aug 01, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: mount_entry()
non-functional changes Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c5e30de4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
27 deletions
+41
-27
conf.c
src/lxc/conf.c
+41
-27
No files found.
src/lxc/conf.c
View file @
0ac4b28a
...
...
@@ -1726,77 +1726,91 @@ static char *get_field(char *src, int nfields)
static
int
mount_entry
(
const
char
*
fsname
,
const
char
*
target
,
const
char
*
fstype
,
unsigned
long
mountflags
,
const
char
*
data
,
int
optional
,
int
dev
,
const
char
*
rootfs
)
const
char
*
data
,
int
optional
,
int
dev
,
const
char
*
rootfs
)
{
int
ret
;
#ifdef HAVE_STATVFS
struct
statvfs
sb
;
#endif
if
(
safe_mount
(
fsname
,
target
,
fstype
,
mountflags
&
~
MS_REMOUNT
,
data
,
rootfs
))
{
ret
=
safe_mount
(
fsname
,
target
,
fstype
,
mountflags
&
~
MS_REMOUNT
,
data
,
rootfs
);
if
(
ret
<
0
)
{
if
(
optional
)
{
INFO
(
"
failed to mount '%s' on '%s' (optional): %s"
,
fsname
,
target
,
strerror
(
errno
));
INFO
(
"
Failed to mount
\"
%s
\"
on
\"
%s
\"
(optional): %s"
,
fsname
,
target
,
strerror
(
errno
));
return
0
;
}
else
{
SYSERROR
(
"failed to mount '%s' on '%s'"
,
fsname
,
target
);
return
-
1
;
}
SYSERROR
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
fsname
,
target
);
return
-
1
;
}
if
((
mountflags
&
MS_REMOUNT
)
||
(
mountflags
&
MS_BIND
))
{
DEBUG
(
"remounting %s on %s to respect bind or remount options"
,
fsname
?
fsname
:
"(none)"
,
target
?
target
:
"(none)"
);
unsigned
long
rqd_flags
=
0
;
DEBUG
(
"Remounting
\"
%s
\"
on
\"
%s
\"
to respect bind or remount "
"options"
,
fsname
?
fsname
:
"(none)"
,
target
?
target
:
"(none)"
);
if
(
mountflags
&
MS_RDONLY
)
rqd_flags
|=
MS_RDONLY
;
#ifdef HAVE_STATVFS
if
(
statvfs
(
fsname
,
&
sb
)
==
0
)
{
unsigned
long
required_flags
=
rqd_flags
;
if
(
sb
.
f_flag
&
MS_NOSUID
)
required_flags
|=
MS_NOSUID
;
if
(
sb
.
f_flag
&
MS_NODEV
&&
!
dev
)
required_flags
|=
MS_NODEV
;
if
(
sb
.
f_flag
&
MS_RDONLY
)
required_flags
|=
MS_RDONLY
;
if
(
sb
.
f_flag
&
MS_NOEXEC
)
required_flags
|=
MS_NOEXEC
;
DEBUG
(
"(at remount) flags for %s was %lu, required extra flags are %lu"
,
fsname
,
sb
.
f_flag
,
required_flags
);
/*
* If this was a bind mount request, and required_flags
DEBUG
(
"Flags for
\"
%s
\"
were %lu, required extra flags "
"are %lu"
,
fsname
,
sb
.
f_flag
,
required_flags
);
/* If this was a bind mount request, and required_flags
* does not have any flags which are not already in
* mountflags, then skip the remount
* mountflags, then skip the remount
.
*/
if
(
!
(
mountflags
&
MS_REMOUNT
))
{
if
(
!
(
required_flags
&
~
mountflags
)
&&
rqd_flags
==
0
)
{
DEBUG
(
"mountflags already was %lu, skipping remount"
,
mountflags
);
if
(
!
(
required_flags
&
~
mountflags
)
&&
rqd_flags
==
0
)
{
DEBUG
(
"Mountflags already were %lu, "
"skipping remount"
,
mountflags
);
goto
skipremount
;
}
}
mountflags
|=
required_flags
;
}
#endif
if
(
mount
(
fsname
,
target
,
fstype
,
mountflags
|
MS_REMOUNT
,
data
)
<
0
)
{
ret
=
mount
(
fsname
,
target
,
fstype
,
mountflags
|
MS_REMOUNT
,
data
);
if
(
ret
<
0
)
{
if
(
optional
)
{
INFO
(
"failed to mount '%s' on '%s' (optional): %s"
,
fsname
,
target
,
strerror
(
errno
));
INFO
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
"(optional): %s"
,
fsname
,
target
,
strerror
(
errno
));
return
0
;
}
else
{
SYSERROR
(
"failed to mount '%s' on '%s'"
,
fsname
,
target
);
return
-
1
;
}
SYSERROR
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
fsname
,
target
);
return
-
1
;
}
}
#ifdef HAVE_STATVFS
skipremount:
#endif
DEBUG
(
"mounted '%s' on '%s', type '%s'"
,
fsname
,
target
,
fstype
);
DEBUG
(
"Mounted
\"
%s
\"
on
\"
%s
\"
with filesystem type
\"
%s
\"
"
,
fsname
,
target
,
fstype
);
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