[lvm-devel] master - tests: check for open_count
Zdenek Kabelac
zkabelac at fedoraproject.org
Mon May 4 08:21:33 UTC 2015
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2d10a6f6aef9eb013986c40a8bd83db6f571472f
Commit: 2d10a6f6aef9eb013986c40a8bd83db6f571472f
Parent: 7a588bce7bd032175d56a1a10af528d61e1c554b
Author: Zdenek Kabelac <zkabelac at redhat.com>
AuthorDate: Mon May 4 10:18:44 2015 +0200
Committer: Zdenek Kabelac <zkabelac at redhat.com>
CommitterDate: Mon May 4 10:18:44 2015 +0200
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.
---
test/shell/snapshot-autoumount-dmeventd.sh | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/test/shell/snapshot-autoumount-dmeventd.sh b/test/shell/snapshot-autoumount-dmeventd.sh
index e059684..860d170 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"
More information about the lvm-devel
mailing list