summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-06 10:57:17 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-06 11:28:16 +0200
commitd9e2daaf3d8649650cf9784b4fe9d9de4507da0c (patch)
treea6f5960da742e676f249036e59656dac040ecaed /src/import
parent41d1ed059bbc863c73161f39594de2eb7b338886 (diff)
btrfs: support recursively removing btrfs snapshots
Diffstat (limited to 'src/import')
-rw-r--r--src/import/export-tar.c2
-rw-r--r--src/import/import-raw.c6
-rw-r--r--src/import/import-tar.c9
-rw-r--r--src/import/pull-common.c6
-rw-r--r--src/import/pull-dkr.c3
-rw-r--r--src/import/pull-raw.c6
-rw-r--r--src/import/pull-tar.c3
7 files changed, 12 insertions, 23 deletions
diff --git a/src/import/export-tar.c b/src/import/export-tar.c
index c27bab46b0..c2fd656527 100644
--- a/src/import/export-tar.c
+++ b/src/import/export-tar.c
@@ -77,7 +77,7 @@ TarExport *tar_export_unref(TarExport *e) {
}
if (e->temp_path) {
- (void) btrfs_subvol_remove(e->temp_path);
+ (void) btrfs_subvol_remove(e->temp_path, false);
free(e->temp_path);
}
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index 3a315139e5..ad8f806aff 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -241,10 +241,8 @@ static int raw_import_finish(RawImport *i) {
return r;
}
- if (i->force_local) {
- (void) btrfs_subvol_remove(i->final_path);
- (void) rm_rf(i->final_path, REMOVE_ROOT|REMOVE_PHYSICAL);
- }
+ if (i->force_local)
+ (void) rm_rf(i->final_path, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
r = rename_noreplace(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path);
if (r < 0)
diff --git a/src/import/import-tar.c b/src/import/import-tar.c
index c5346ca2b0..6ec5504265 100644
--- a/src/import/import-tar.c
+++ b/src/import/import-tar.c
@@ -87,8 +87,7 @@ TarImport* tar_import_unref(TarImport *i) {
}
if (i->temp_path) {
- (void) btrfs_subvol_remove(i->temp_path);
- (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL);
+ (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
free(i->temp_path);
}
@@ -197,10 +196,8 @@ static int tar_import_finish(TarImport *i) {
return r;
}
- if (i->force_local) {
- (void) btrfs_subvol_remove(i->final_path);
- (void) rm_rf(i->final_path, REMOVE_ROOT|REMOVE_PHYSICAL);
- }
+ if (i->force_local)
+ (void) rm_rf(i->final_path, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
r = rename_noreplace(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path);
if (r < 0)
diff --git a/src/import/pull-common.c b/src/import/pull-common.c
index d4cebe205e..ee0c064dfc 100644
--- a/src/import/pull-common.c
+++ b/src/import/pull-common.c
@@ -124,10 +124,8 @@ int pull_make_local_copy(const char *final, const char *image_root, const char *
p = strjoina(image_root, "/", local);
- if (force_local) {
- (void) btrfs_subvol_remove(p);
- (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
- }
+ if (force_local)
+ (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
r = btrfs_subvol_snapshot(final, p, false, false);
if (r == -ENOTTY) {
diff --git a/src/import/pull-dkr.c b/src/import/pull-dkr.c
index a1e6fe8ff7..402ddac32b 100644
--- a/src/import/pull-dkr.c
+++ b/src/import/pull-dkr.c
@@ -111,8 +111,7 @@ DkrPull* dkr_pull_unref(DkrPull *i) {
sd_event_unref(i->event);
if (i->temp_path) {
- (void) btrfs_subvol_remove(i->temp_path);
- (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL);
+ (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
free(i->temp_path);
}
diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c
index e10b280b66..ebbe6a9cd3 100644
--- a/src/import/pull-raw.c
+++ b/src/import/pull-raw.c
@@ -277,10 +277,8 @@ static int raw_pull_make_local_copy(RawPull *i) {
p = strjoina(i->image_root, "/", i->local, ".raw");
- if (i->force_local) {
- (void) btrfs_subvol_remove(p);
- (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
- }
+ if (i->force_local)
+ (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
r = tempfn_random(p, &tp);
if (r < 0)
diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c
index 60dc22fdfa..0efa07d3f3 100644
--- a/src/import/pull-tar.c
+++ b/src/import/pull-tar.c
@@ -88,8 +88,7 @@ TarPull* tar_pull_unref(TarPull *i) {
sd_event_unref(i->event);
if (i->temp_path) {
- (void) btrfs_subvol_remove(i->temp_path);
- (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL);
+ (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
free(i->temp_path);
}