summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2015-05-04 10:18:44 +0200
committerZdenek Kabelac <zkabelac@redhat.com>2015-05-04 10:18:44 +0200
commit2d10a6f6aef9eb013986c40a8bd83db6f571472f (patch)
tree85ebf526763b4bf65def722dd409dd8ec5b4cfb9
parent7a588bce7bd032175d56a1a10af528d61e1c554b (diff)
downloadlvm2-2d10a6f6aef9eb013986c40a8bd83db6f571472f.tar.gz
tests: check for open_count
Instead of checking /proc/mounts check for open_count of snap device. Parallel umount has race, so check for open_count.
-rw-r--r--test/shell/snapshot-autoumount-dmeventd.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/shell/snapshot-autoumount-dmeventd.sh b/test/shell/snapshot-autoumount-dmeventd.sh
index e0596849c..860d170b8 100644
--- a/test/shell/snapshot-autoumount-dmeventd.sh
+++ b/test/shell/snapshot-autoumount-dmeventd.sh
@@ -30,14 +30,17 @@ lvchange --monitor y $vg/snap
mkdir "$mntdir"
mount "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
-mount
+
cat /proc/mounts | grep "$mntdir"
not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=5 oflag=direct
-#dmeventd only checks every 10 seconds :(
-for i in {1..10}; do
- cat /proc/mounts | grep "$mntdir" || break
- sleep 1
+# Should be nearly instant check of dmeventd for invalid snapshot.
+# Wait here for umount and open_count drops to 0 as it may
+# take a while to finalize umount operation (it might be already
+# removed from /proc/mounts, but still opened).
+for i in {1..100}; do
+ test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 0 && break
+ sleep .1
done
cat /proc/mounts | not grep "$mntdir"