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
91e7dd57
Commit
91e7dd57
authored
Aug 16, 2016
by
Stéphane Graber
Committed by
GitHub
Aug 16, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1134 from brauner/2016-08-16/load_correct_ovl_module
bdev: use correct overlay module name
parents
acdab4e3
88232d3f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
15 deletions
+38
-15
lxcoverlay.c
src/lxc/bdev/lxcoverlay.c
+38
-15
No files found.
src/lxc/bdev/lxcoverlay.c
View file @
91e7dd57
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
lxc_log_define
(
lxcoverlay
,
lxc
);
lxc_log_define
(
lxcoverlay
,
lxc
);
static
char
*
ovl_name
;
static
char
*
ovl_name
;
static
char
*
ovl_version
[]
=
{
"overlay"
,
"overlayfs"
};
/* defined in lxccontainer.c: needs to become common helper */
/* defined in lxccontainer.c: needs to become common helper */
extern
char
*
dir_new_path
(
char
*
src
,
const
char
*
oldname
,
const
char
*
name
,
extern
char
*
dir_new_path
(
char
*
src
,
const
char
*
oldname
,
const
char
*
name
,
...
@@ -49,6 +50,9 @@ static int ovl_do_rsync(struct bdev *orig, struct bdev *new,
...
@@ -49,6 +50,9 @@ static int ovl_do_rsync(struct bdev *orig, struct bdev *new,
struct
lxc_conf
*
conf
);
struct
lxc_conf
*
conf
);
static
int
ovl_rsync
(
struct
rsync_data
*
data
);
static
int
ovl_rsync
(
struct
rsync_data
*
data
);
static
int
ovl_rsync_wrapper
(
void
*
data
);
static
int
ovl_rsync_wrapper
(
void
*
data
);
static
int
ovl_remount_on_enodev
(
const
char
*
lower
,
const
char
*
target
,
const
char
*
name
,
unsigned
long
mountflags
,
const
void
*
options
);
int
ovl_clonepaths
(
struct
bdev
*
orig
,
struct
bdev
*
new
,
const
char
*
oldname
,
int
ovl_clonepaths
(
struct
bdev
*
orig
,
struct
bdev
*
new
,
const
char
*
oldname
,
const
char
*
cname
,
const
char
*
oldpath
,
const
char
*
lxcpath
,
const
char
*
cname
,
const
char
*
oldpath
,
const
char
*
lxcpath
,
...
@@ -408,23 +412,28 @@ int ovl_mount(struct bdev *bdev)
...
@@ -408,23 +412,28 @@ int ovl_mount(struct bdev *bdev)
return
-
1
;
return
-
1
;
}
}
// mount without workdir option for overlayfs before v21
/* Assume we need a workdir as we are on a overlay version >= v22. */
ret
=
mount
(
lower
,
bdev
->
dest
,
ovl_name
,
MS_MGC_VAL
|
mntflags
,
options
);
ret
=
ovl_remount_on_enodev
(
lower
,
bdev
->
dest
,
ovl_name
,
MS_MGC_VAL
|
mntflags
,
options_work
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
INFO
(
"overlayfs: error mounting %s onto %s options %s. retry with workdir"
,
INFO
(
"Overlayfs: Error mounting %s onto %s with options %s. "
lower
,
bdev
->
dest
,
options
);
"Retrying without workdir: %s."
,
lower
,
bdev
->
dest
,
options_work
,
strerror
(
errno
));
// retry with workdir option for overlayfs v22 and higher
/* Assume we cannot use a workdir as we are on a version <= v21. */
ret
=
mount
(
lower
,
bdev
->
dest
,
ovl_name
,
MS_MGC_VAL
|
mntflags
,
options_work
);
ret
=
ovl_remount_on_enodev
(
lower
,
bdev
->
dest
,
ovl_name
,
MS_MGC_VAL
|
mntflags
,
options
);
if
(
ret
<
0
)
if
(
ret
<
0
)
SYSERROR
(
"overlayfs: error mounting %s onto %s options %s"
,
SYSERROR
(
"Overlayfs: Error mounting %s onto %s with "
lower
,
bdev
->
dest
,
options_work
);
"options %s: %s."
,
lower
,
bdev
->
dest
,
options
,
strerror
(
errno
));
else
else
INFO
(
"overlayfs: mounted %s onto %s options %s"
,
INFO
(
"Overlayfs: Mounted %s onto %s with options %s."
,
lower
,
bdev
->
dest
,
options_work
);
}
else
{
INFO
(
"overlayfs: mounted %s onto %s options %s"
,
lower
,
bdev
->
dest
,
options
);
lower
,
bdev
->
dest
,
options
);
}
else
{
INFO
(
"Overlayfs: Mounted %s onto %s with options %s."
,
lower
,
bdev
->
dest
,
options_work
);
}
}
return
ret
;
return
ret
;
}
}
...
@@ -652,6 +661,20 @@ err:
...
@@ -652,6 +661,20 @@ err:
return
fret
;
return
fret
;
}
}
static
int
ovl_remount_on_enodev
(
const
char
*
lower
,
const
char
*
target
,
const
char
*
name
,
unsigned
long
mountflags
,
const
void
*
options
)
{
int
ret
;
ret
=
mount
(
lower
,
target
,
ovl_name
,
MS_MGC_VAL
|
mountflags
,
options
);
if
(
ret
<
0
&&
errno
==
ENODEV
)
/* Try other module name. */
ret
=
mount
(
lower
,
target
,
ovl_name
==
ovl_version
[
0
]
?
ovl_version
[
1
]
:
ovl_version
[
0
],
MS_MGC_VAL
|
mountflags
,
options
);
return
ret
;
}
static
int
ovl_rsync
(
struct
rsync_data
*
data
)
static
int
ovl_rsync
(
struct
rsync_data
*
data
)
{
{
int
ret
;
int
ret
;
...
@@ -700,7 +723,7 @@ static int ovl_rsync(struct rsync_data *data)
...
@@ -700,7 +723,7 @@ static int ovl_rsync(struct rsync_data *data)
static
char
*
ovl_detect_name
(
void
)
static
char
*
ovl_detect_name
(
void
)
{
{
char
*
v
=
"overlayfs"
;
char
*
v
=
ovl_version
[
0
]
;
char
*
line
=
NULL
;
char
*
line
=
NULL
;
size_t
len
=
0
;
size_t
len
=
0
;
FILE
*
f
=
fopen
(
"/proc/filesystems"
,
"r"
);
FILE
*
f
=
fopen
(
"/proc/filesystems"
,
"r"
);
...
@@ -708,8 +731,8 @@ static char *ovl_detect_name(void)
...
@@ -708,8 +731,8 @@ static char *ovl_detect_name(void)
return
v
;
return
v
;
while
(
getline
(
&
line
,
&
len
,
f
)
!=
-
1
)
{
while
(
getline
(
&
line
,
&
len
,
f
)
!=
-
1
)
{
if
(
strcmp
(
line
,
"nodev
\t
overlay
\n
"
)
==
0
)
{
if
(
strcmp
(
line
,
"nodev
\t
overlay
fs
\n
"
)
==
0
)
{
v
=
"overlay"
;
v
=
ovl_version
[
1
]
;
break
;
break
;
}
}
}
}
...
...
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