Skip to contentSkip to conversation

dev-mornfall-activate - snapshot: fix check for snapshot-merge target presence

PATCH Petr Rockai 1 participant 1 message Jun 4, 2013

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4f6c2951d6495ee335ab69da44ae2647cd341276
Commit:        4f6c2951d6495ee335ab69da44ae2647cd341276
Parent:        f12d88f840474a75a58d1f7ae8d391ec5852b850
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Thu May 16 08:12:37 2013 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Thu May 16 08:17:18 2013 +0200

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 files changed, 5 insertions(+), 3 deletions(-)
lib/snapshot/snapshot.c +5 -3
index 3c03ea9..2bab9d2 100644
@@ -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;
 	}