From: Andre Noll <maan@systemlinux.org>
Date: Mon, 8 Jun 2009 06:15:18 +0000 (+0200)
Subject: Don't remove the last snapshot unless disk space is low.
X-Git-Tag: v0.1.3~3
X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=0f690a04483ee9833f371a4a807b6897e9e3d9d8;p=dss.git

Don't remove the last snapshot unless disk space is low.
---

diff --git a/dss.c b/dss.c
index d2afc10..089f954 100644
--- a/dss.c
+++ b/dss.c
@@ -432,6 +432,9 @@ static int try_to_free_disk_space(int low_disk_space)
 	if (!low_disk_space && conf.keep_redundant_given)
 		return 0;
 	dss_get_snapshot_list(&sl);
+	ret = 0;
+	if (!low_disk_space && sl.num_snapshots <= 1)
+		goto out;
 	why = "outdated";
 	victim = find_outdated_snapshot(&sl);
 	if (victim)
@@ -441,7 +444,6 @@ static int try_to_free_disk_space(int low_disk_space)
 	if (victim)
 		goto remove;
 	/* try harder only if disk space is low */
-	ret = 0;
 	if (!low_disk_space)
 		goto out;
 	why = "orphaned";