From 4f6c2951d6495ee335ab69da44ae2647cd341276 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Thu, 16 May 2013 08:12:37 +0200 Subject: [PATCH] snapshot: fix check for snapshot-merge target presence If calling _snap_target_present on 2nd and later call and for a segment with MERGING flag set, we must return the status of snapshot as well as snapshot-merge target presence, not just the snapshot one. --- lib/snapshot/snapshot.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c index 3c03ea932..2bab9d2ea 100644 --- a/lib/snapshot/snapshot.c +++ b/lib/snapshot/snapshot.c @@ -162,9 +162,11 @@ static int _snap_target_present(struct cmd_context *cmd, _snap_checked = 1; } - if (!_snap_merge_checked && seg && (seg->status & MERGING)) { - _snap_merge_present = target_present(cmd, "snapshot-merge", 0); - _snap_merge_checked = 1; + if (seg && (seg->status & MERGING)) { + if (!_snap_merge_checked) { + _snap_merge_present = target_present(cmd, "snapshot-merge", 0); + _snap_merge_checked = 1; + } return _snap_present && _snap_merge_present; } -- 2.43.5