]> git.tuebingen.mpg.de Git - dss.git/commitdiff
Fix return value of remove_oldest_snapshot().
authorAndre Noll <maan@systemlinux.org>
Tue, 5 May 2009 08:53:43 +0000 (10:53 +0200)
committerAndre Noll <maan@systemlinux.org>
Tue, 5 May 2009 08:53:43 +0000 (10:53 +0200)
We _must_ return non-zero if the remove was initiated. The old code
would exit with

try_to_free_disk_space: uhuhu: not enough disk space for a single snapshot

even though there are plenty of snapshots available that can be deleted.

dss.c

diff --git a/dss.c b/dss.c
index c0597f3af32e4586d6fbb98f78aea9b59f338aff..27c14b6720d47fc88721c7bd25765affc791daa9 100644 (file)
--- a/dss.c
+++ b/dss.c
@@ -367,6 +367,7 @@ static int remove_outdated_snapshot(struct snapshot_list *sl)
 
 static int remove_oldest_snapshot(struct snapshot_list *sl)
 {
+       int ret;
        struct snapshot *s = get_oldest_snapshot(sl);
 
        if (!s) /* no snapshot found */
@@ -374,7 +375,10 @@ static int remove_oldest_snapshot(struct snapshot_list *sl)
        DSS_INFO_LOG("oldest snapshot: %s\n", s->name);
        if (snapshot_is_being_created(s))
                return 0;
-       return pre_remove_hook(s, "oldest");
+       ret = pre_remove_hook(s, "oldest");
+       if (ret < 0)
+               return ret;
+       return 1;
 }
 
 static int rename_incomplete_snapshot(int64_t start)