mirror of
https://github.com/systemd/systemd.git
synced 2025-01-27 18:04:05 +03:00
import: set up btrfs qgroups on correct hierarchy
Also, simplify import_assign_pool_quota_and_warn(), don't do the same thing twice. Let's just allow the caller call this twice.
This commit is contained in:
parent
2ab214eac1
commit
052ba0ebae
@ -196,6 +196,7 @@ static int import_fs(int argc, char *argv[], void *userdata) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
|
(void) import_assign_pool_quota_and_warn(arg_image_root);
|
||||||
(void) import_assign_pool_quota_and_warn(temp_path);
|
(void) import_assign_pool_quota_and_warn(temp_path);
|
||||||
|
|
||||||
if (arg_read_only) {
|
if (arg_read_only) {
|
||||||
|
@ -222,8 +222,10 @@ static int tar_import_fork_tar(TarImport *i) {
|
|||||||
r = btrfs_subvol_make_fallback(i->temp_path, 0755);
|
r = btrfs_subvol_make_fallback(i->temp_path, 0755);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to create directory/subvolume %s: %m", i->temp_path);
|
return log_error_errno(r, "Failed to create directory/subvolume %s: %m", i->temp_path);
|
||||||
if (r > 0) /* actually btrfs subvol */
|
if (r > 0) { /* actually btrfs subvol */
|
||||||
|
(void) import_assign_pool_quota_and_warn(i->image_root);
|
||||||
(void) import_assign_pool_quota_and_warn(i->temp_path);
|
(void) import_assign_pool_quota_and_warn(i->temp_path);
|
||||||
|
}
|
||||||
|
|
||||||
i->tar_fd = import_fork_tar_x(i->temp_path, &i->tar_pid);
|
i->tar_fd = import_fork_tar_x(i->temp_path, &i->tar_pid);
|
||||||
if (i->tar_fd < 0)
|
if (i->tar_fd < 0)
|
||||||
|
@ -424,8 +424,10 @@ static int tar_pull_job_on_open_disk_tar(PullJob *j) {
|
|||||||
r = btrfs_subvol_make_fallback(i->temp_path, 0755);
|
r = btrfs_subvol_make_fallback(i->temp_path, 0755);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to create directory/subvolume %s: %m", i->temp_path);
|
return log_error_errno(r, "Failed to create directory/subvolume %s: %m", i->temp_path);
|
||||||
if (r > 0) /* actually btrfs subvol */
|
if (r > 0) { /* actually btrfs subvol */
|
||||||
|
(void) import_assign_pool_quota_and_warn(i->image_root);
|
||||||
(void) import_assign_pool_quota_and_warn(i->temp_path);
|
(void) import_assign_pool_quota_and_warn(i->temp_path);
|
||||||
|
}
|
||||||
|
|
||||||
j->disk_fd = import_fork_tar_x(i->temp_path, &i->tar_pid);
|
j->disk_fd = import_fork_tar_x(i->temp_path, &i->tar_pid);
|
||||||
if (j->disk_fd < 0)
|
if (j->disk_fd < 0)
|
||||||
|
@ -143,15 +143,7 @@ int raw_strip_suffixes(const char *p, char **ret) {
|
|||||||
int import_assign_pool_quota_and_warn(const char *path) {
|
int import_assign_pool_quota_and_warn(const char *path) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = btrfs_subvol_auto_qgroup("/var/lib/machines", 0, true);
|
assert(path);
|
||||||
if (r == -ENOTTY) {
|
|
||||||
log_debug_errno(r, "Failed to set up default quota hierarchy for /var/lib/machines, as directory is not on btrfs or not a subvolume. Ignoring.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (r < 0)
|
|
||||||
return log_error_errno(r, "Failed to set up default quota hierarchy for /var/lib/machines: %m");
|
|
||||||
if (r > 0)
|
|
||||||
log_info("Set up default quota hierarchy for /var/lib/machines.");
|
|
||||||
|
|
||||||
r = btrfs_subvol_auto_qgroup(path, 0, true);
|
r = btrfs_subvol_auto_qgroup(path, 0, true);
|
||||||
if (r == -ENOTTY) {
|
if (r == -ENOTTY) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user