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
28602de3
Unverified
Commit
28602de3
authored
Apr 28, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage/dir: cleanup mount code
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
510026de
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
13 deletions
+10
-13
dir.c
src/lxc/storage/dir.c
+10
-13
No files found.
src/lxc/storage/dir.c
View file @
28602de3
...
@@ -129,7 +129,6 @@ int dir_mount(struct lxc_storage *bdev)
...
@@ -129,7 +129,6 @@ int dir_mount(struct lxc_storage *bdev)
{
{
struct
lxc_rootfs
*
rootfs
=
bdev
->
rootfs
;
struct
lxc_rootfs
*
rootfs
=
bdev
->
rootfs
;
struct
lxc_mount_options
*
mnt_opts
=
&
rootfs
->
mnt_opts
;
struct
lxc_mount_options
*
mnt_opts
=
&
rootfs
->
mnt_opts
;
unsigned
long
mflags
=
0
;
int
ret
;
int
ret
;
const
char
*
source
,
*
target
;
const
char
*
source
,
*
target
;
...
@@ -172,23 +171,21 @@ int dir_mount(struct lxc_storage *bdev)
...
@@ -172,23 +171,21 @@ int dir_mount(struct lxc_storage *bdev)
}
}
}
else
{
}
else
{
ret
=
mount
(
source
,
target
,
"bind"
,
MS_BIND
|
MS_REC
|
mnt_opts
->
mnt_flags
|
mnt_opts
->
prop_flags
,
mnt_opts
->
data
);
ret
=
mount
(
source
,
target
,
"bind"
,
MS_BIND
|
MS_REC
|
mnt_opts
->
mnt_flags
|
mnt_opts
->
prop_flags
,
mnt_opts
->
data
);
if
(
ret
<
0
)
if
(
!
ret
&&
(
mnt_opts
->
mnt_flags
&
MS_RDONLY
))
{
return
log_error_errno
(
-
errno
,
errno
,
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
source
,
target
)
;
unsigned
long
mflags
;
if
(
ret
==
0
&&
(
mnt_opts
->
mnt_flags
&
MS_RDONLY
))
{
mflags
=
add_required_remount_flags
(
source
,
target
,
mflags
=
add_required_remount_flags
(
source
,
target
,
MS_BIND
|
MS_REC
|
mnt_opts
->
mnt_flags
|
mnt_opts
->
mnt_flags
|
MS_REMOUNT
);
MS_BIND
|
MS_REC
|
mnt_opts
->
mnt_flags
|
MS_REMOUNT
);
ret
=
mount
(
source
,
target
,
"bind"
,
mflags
,
mnt_opts
->
data
);
ret
=
mount
(
source
,
target
,
"bind"
,
mflags
,
mnt_opts
->
data
);
if
(
ret
<
0
)
if
(
ret
)
return
log_error_errno
(
-
errno
,
errno
,
"Failed to remount
\"
%s
\"
on
\"
%s
\"
read-only with options
\"
%s
\"
, mount flags
\"
%lu
\"
, and propagation flags
\"
%lu
\"
"
,
SYSERROR
(
"Failed to remount
\"
%s
\"
on
\"
%s
\"
read-only"
,
source
,
target
);
source
,
target
,
mnt_opts
->
data
,
mflags
,
mnt_opts
->
mnt_flags
);
else
else
DEBUG
(
"Remounted
\"
%s
\"
on
\"
%s
\"
read-only with options
\"
%s
\"
, mount flags
\"
%lu
\"
, and propagation flags
\"
%lu
\"
"
,
TRACE
(
"Remounted
\"
%s
\"
on
\"
%s
\"
read-only"
,
source
,
target
);
source
,
target
,
mnt_opts
->
data
,
mflags
,
mnt_opts
->
mnt_flags
);
}
}
TRACE
(
"Mounted
\"
%s
\"
on
\"
%s
\"
with options
\"
%s
\"
, mount flags
\"
%lu
\"
, and propagation flags
\"
%lu
\"
"
,
source
,
target
,
mnt_opts
->
data
,
mflags
,
mnt_opts
->
mnt_flags
);
}
}
if
(
ret
<
0
)
if
(
ret
<
0
)
return
syserror_set
(
ret
,
"Failed to mount
\"
%s
\"
onto
\"
%s
\"
"
,
source
,
target
);
return
syserror_set
(
ret
,
"Failed to mount
\"
%s
\"
onto
\"
%s
\"
"
,
source
,
target
);
...
...
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