Skip to contentSkip to conversation

master - tests: use remount-ro for extfs

PATCH Zdenek Kabelac 1 participant 1 message Sep 18, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7d1dd5f52d26ebe15dd6de211001ece975be2c7c
Commit:        7d1dd5f52d26ebe15dd6de211001ece975be2c7c
Parent:        330d584617778b2ac3a852d482c6b8d49818d9eb
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Fri Sep 18 15:08:28 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Fri Sep 18 17:45:46 2015 +0200

tests: use remount-ro for extfs

Avoid showing kernel warn of umounting broken fs.

---
 test/shell/snapshot-autoumount-dmeventd.sh |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
test/shell/snapshot-autoumount-dmeventd.sh +9 -4
index 9fc1c72..e82a757 100644
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved.
 #
 # This copyrighted material is made available to anyone wishing to use,
 # modify, copy, or redistribute it subject to the terms and conditions
@@ -31,18 +31,23 @@ lvcreate -s -L4 -n snap $vg/base
 lvchange --monitor y $vg/snap
 
 mkdir "$mntdir"
-mount "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
+# Use remount-ro  to avoid logging kernel WARNING
+mount -o errors=remount-ro "$DM_DEV_DIR/mapper/$vg-snap" "$mntdir"
+
+test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 1
 
 cat /proc/mounts | grep "$mntdir"
-not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=5 conv=fdatasync
+
+# overfill 4M snapshot (with metadata)
+not dd if=/dev/zero of="$mntdir/file$1" bs=1M count=4 conv=fdatasync
 
 # 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
+	test $(dmsetup info -c --noheadings -o open $vg-snap) -eq 0 && break
 done
 
 cat /proc/mounts | not grep "$mntdir"