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
2d66f571
Unverified
Commit
2d66f571
authored
Jul 16, 2017
by
Christian Brauner
Committed by
Stéphane Graber
Aug 14, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
btrfs: enable unprivileged snapshots
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
707f3fff
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
bdev.c
src/lxc/bdev/bdev.c
+14
-3
No files found.
src/lxc/bdev/bdev.c
View file @
2d66f571
...
@@ -432,17 +432,28 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
...
@@ -432,17 +432,28 @@ struct bdev *bdev_copy(struct lxc_container *c0, const char *cname,
if
(
bdevtype
&&
strcmp
(
orig
->
type
,
"btrfs"
)
==
0
&&
if
(
bdevtype
&&
strcmp
(
orig
->
type
,
"btrfs"
)
==
0
&&
strcmp
(
new
->
type
,
"btrfs"
)
==
0
&&
strcmp
(
new
->
type
,
"btrfs"
)
==
0
&&
btrfs_same_fs
(
orig
->
dest
,
new
->
dest
)
==
0
)
{
btrfs_same_fs
(
orig
->
dest
,
new
->
dest
)
==
0
)
{
struct
rsync_data_char
arg
;
if
(
btrfs_destroy
(
new
)
<
0
)
{
if
(
btrfs_destroy
(
new
)
<
0
)
{
ERROR
(
"Error destroying %s subvolume"
,
new
->
dest
);
ERROR
(
"Error destroying %s subvolume"
,
new
->
dest
);
goto
err
;
goto
err
;
}
}
if
(
mkdir_p
(
new
->
dest
,
0755
)
<
0
)
{
if
(
mkdir_p
(
new
->
dest
,
0755
)
<
0
)
{
ERROR
(
"Error creating %s directory"
,
new
->
dest
);
ERROR
(
"Error creating %s directory"
,
new
->
dest
);
goto
err
;
goto
err
;
}
}
if
(
btrfs_snapshot
(
orig
->
dest
,
new
->
dest
)
<
0
)
{
ERROR
(
"Error restoring %s to %s"
,
orig
->
dest
,
arg
.
src
=
orig
->
dest
;
new
->
dest
);
arg
.
dest
=
new
->
dest
;
if
(
am_unpriv
())
ret
=
userns_exec_1
(
c0
->
lxc_conf
,
btrfs_snapshot_wrapper
,
&
arg
,
"btrfs_snapshot_wrapper"
);
else
ret
=
btrfs_snapshot
(
orig
->
dest
,
new
->
dest
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to create btrfs snapshot
\"
%s
\"
of
\"
%s
\"
"
,
new
->
dest
,
orig
->
dest
);
goto
err
;
goto
err
;
}
}
bdev_put
(
orig
);
bdev_put
(
orig
);
...
...
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