From 97790d7fa5e13c61c95d1a48e1520ac00a983768 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 5 May 2009 10:53:43 +0200 Subject: [PATCH] Fix return value of remove_oldest_snapshot(). 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dss.c b/dss.c index c0597f3..27c14b6 100644 --- 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) -- 2.39.5