[lvm-devel] dev-mornfall-lvmcache - snapshot: fix check for snapshot-merge target presence

Petr Rockai mornfall at fedoraproject.org
Wed Jun 5 12:03:30 UTC 2013


Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4f6c2951d6495ee335ab69da44ae2647cd341276
Commit:        4f6c2951d6495ee335ab69da44ae2647cd341276
Parent:        f12d88f840474a75a58d1f7ae8d391ec5852b850
Author:        Peter Rajnoha <prajnoha at redhat.com>
AuthorDate:    Thu May 16 08:12:37 2013 +0200
Committer:     Peter Rajnoha <prajnoha at redhat.com>
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(-)

diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index 3c03ea9..2bab9d2 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;
 	}
 




More information about the lvm-devel mailing list